]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: fix the extent length error of the sync read 25708/head
authorXiaofei Cui <cuixiaofei@sangfor.com.cn>
Mon, 17 Dec 2018 08:56:59 +0000 (16:56 +0800)
committerJos Collin <jcollin@redhat.com>
Thu, 27 Dec 2018 06:22:55 +0000 (11:52 +0530)
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 fd5d2d6d6eb39151d6d96105e83bfd39749d79d5)

src/osd/PrimaryLogPG.cc

index 5d0805cc05bcfbae32f7eebb2e3d449cc9e156c8..0a4465c997eecbe793f239db5f0641e859d716b0 100644 (file)
@@ -5470,7 +5470,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;
     }