Skip to content

Commit

Permalink
osd/PrimaryLogPG: fix the extent length error of the sync read
Browse files Browse the repository at this point in the history
The extent.length of the sync read is changed to 0, when
the read is failed. This makes the retry of the read with
a offset of 0 to read the total object.
Let the extent.length as it is, if the return code is -EAGAIN,
which will make the read try again later with the correct
extent.length.

Fixes: https://tracker.ceph.com/issues/37680
Signed-off-by: Xiaofei Cui <cuixiaofei@sangfor.com.cn>
(cherry picked from commit fd5d2d6)
  • Loading branch information
Xiaofei Cui authored and ashishkumsingh committed Dec 27, 2018
1 parent 7f094a2 commit 39588fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/osd/PrimaryLogPG.cc
Expand Up @@ -4906,7 +4906,12 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) {
}
if (r >= 0)
op.extent.length = r;
else {
else if (r == -EAGAIN) {
// EAGAIN should not change the length of extent or count the read op.
dout(10) << " read got " << r << " / " << op.extent.length
<< " bytes from obj " << soid << ". try again." << dendl;
return -EAGAIN;
} else {
result = r;
op.extent.length = 0;
}
Expand Down

0 comments on commit 39588fb

Please sign in to comment.