On Sun, Aug 31, 2014 at 6:57 PM, Bingpeng Zhu <nku...@foxmail.com> wrote: > We can use dog vdi check to repair the vdi if some replica is lost. > When creating a erasure coded vdi and some data replica of the vdi > is lost, we run dog vdi check and will see the following error log > sometimes: > failed to write to socket: Bad address > If you don't see the error, you will find the file length of the > recoverd replica is not correct. It is because the replica buffer > length is not set correctly. The buffer overflows, so we get > Bad address error. This patch add the buffer length parameter for > write_object_to() function and set the buffer length correctly. > > Signed-off-by: Bingpeng Zhu <bingpeng....@alibaba-inc.com> > --- > dog/vdi.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-)
Applied, thanks. Hitoshi > > diff --git a/dog/vdi.c b/dog/vdi.c > index 32b3e57..2c7aa19 100644 > --- a/dog/vdi.c > +++ b/dog/vdi.c > @@ -1633,7 +1633,7 @@ out: > } > > static void write_object_to(const struct sd_vnode *vnode, uint64_t oid, > - void *buf, bool create, uint8_t ec_index) > + void *buf, unsigned int len, bool create, uint8_t > ec_index) > { > struct sd_req hdr; > struct sd_rsp *rsp = (struct sd_rsp *)&hdr; > @@ -1645,7 +1645,7 @@ static void write_object_to(const struct sd_vnode > *vnode, uint64_t oid, > sd_init_req(&hdr, SD_OP_WRITE_PEER); > hdr.epoch = sd_epoch; > hdr.flags = SD_FLAG_CMD_WRITE; > - hdr.data_length = get_objsize(oid); > + hdr.data_length = len; > hdr.obj.oid = oid; > hdr.obj.ec_index = ec_index; > > @@ -1872,8 +1872,8 @@ static void check_erasure_object(struct vdi_check_info > *info) > for (i = 0; i < d; i++) > ds[i] = input[i]; > ec_decode_buffer(ctx, ds, input_idx, obj, m); > - write_object_to(info->vcw[m].vnode, oid, obj, true, > - info->vcw[m].ec_index); > + write_object_to(info->vcw[m].vnode, oid, obj, > + len, true, info->vcw[m].ec_index); > fprintf(stdout, "fixed missing %"PRIx64", " > "copy index %d\n", info->oid, m); > } > -- > 1.7.1 > > > -- > sheepdog mailing list > sheepdog@lists.wpkg.org > http://lists.wpkg.org/mailman/listinfo/sheepdog -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog