DAOS-17681 object: fix bug in obj_ec_iom_merge/iom_recx_merge() - #18928
DAOS-17681 object: fix bug in obj_ec_iom_merge/iom_recx_merge()#18928liuxuezhao wants to merge 2 commits into
Conversation
|
Ticket title is 'daos container clone: daos_obj_fetch unexpectedly returns 0 sg_nr_out' |
8d09f6f to
f1ce0d9
Compare
| D_MUTEX_LOCK(&reasb_req->orr_mutex); | ||
|
|
||
| reasb_req->orr_iom_tgt_nr++; | ||
| D_ASSERTF(reasb_req->orr_iom_tgt_nr <= reasb_req->orr_tgt_nr, |
There was a problem hiding this comment.
does that mean now we assert for the case for any EC array fetch with ioms != NULL and more than one iod (nr > 1 array iods)
orr_tgt_nr counts targets only, not targets * iod_nr ?
A per-iod counter array in obj_reasb_req would fix this i suppose
There was a problem hiding this comment.
right, orr_tgt_nr counts targets only.
uses it to check it is the first or last reply.
| * so that the caller can re-allocate iom_recxs and fetch | ||
| * again. iom_nr_out > iom_nr means the iom is truncated. | ||
| */ | ||
| dst->iom_nr_out += reasb_req->orr_iom_nr; |
There was a problem hiding this comment.
With multiple iods the truncation count of iod 0 leaks into iod 1's iom_nr_out.
Same issue as above; it needs to be per-iod.
There was a problem hiding this comment.
you are right, I'll use copilot to fix it.
| if (first) { | ||
| dst->iom_type = src->iom_type; | ||
| dst->iom_size = src->iom_size; | ||
| } |
There was a problem hiding this comment.
suggested:
if (first)
dst->iom_type = src->iom_type;
if (dst->iom_size == 0)
dst->iom_size = src->iom_size;
There was a problem hiding this comment.
we should also reset
/* output field, the caller may pass it uninitialized */
dst->iom_nr_out = 0;
if first.
There was a problem hiding this comment.
OK, I'll refresh it
| D_ASSERTF(dst->iom_nr_out <= dst->iom_nr, "iom_nr_out %d, iom_nr %d\n", | ||
| dst->iom_nr_out, dst->iom_nr); |
There was a problem hiding this comment.
iom_nr_out can be unitialized from user, so assert is not favorable here. if the below initialization is fixed, then this is fine.
There was a problem hiding this comment.
sure, let's set it to 0 for first.
|
one mention from copilot review: Not addressed, but adjacent: |
The original code possibly cause assertion or invalid memory access. Add a test case to reproduce the bug and verify the fix. Signed-off-by: Xuezhao Liu <xuezhao.liu@hpe.com>
f1ce0d9 to
e446cfe
Compare
Signed-off-by: Xuezhao Liu <xuezhao.liu@hpe.com>
e446cfe to
5e30b4a
Compare
|
@mchaarawi the fix and new test in the 2nd commit, thx |
wangshilong
left a comment
There was a problem hiding this comment.
This is a important fix, shall we make it to 2.8.1?
looks better to be in 2.8.1. let's try to backport if possible. |
The original code possibly cause assertion or invalid memory access. Add a test case to reproduce the bug and verify the fix.
Steps for the author:
After all prior steps are complete: