From: Xiaofei Cui Date: Mon, 17 Dec 2018 08:56:59 +0000 (+0800) Subject: osd/PrimaryLogPG: fix the extent length error of the sync read X-Git-Tag: v12.2.12~93^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39588fbfbf6d839b5d1a388a2f9b140bcdb9ec5b;p=ceph.git osd/PrimaryLogPG: fix the extent length error of the sync read 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 (cherry picked from commit fd5d2d6d6eb39151d6d96105e83bfd39749d79d5) --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 3d5e76a75160..91dec73d9518 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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; }