]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set r only if succeed in FillInVerifyExtent 41727/head
authoryanqiang-ux <yanqiang_ux@163.com>
Mon, 7 Jun 2021 07:54:44 +0000 (15:54 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 9 Jun 2021 08:44:06 +0000 (16:44 +0800)
When read failed, ret can be taken as data len in FillInVerifyExtent, which should be avoided.
It may cause errors in crc repair or retry read because of the data len. In my case, we use FillInVerifyExtent for EC read,
when meet -EIO,we will try crc repair, which need read data from other shard accrding to data len.
And I meet assert in ECBackend.cc (loc: line 2288 ceph_assert(range.first != range.second) ), But it seems master branch not support EC crc repair.
In shot, when reuse the readop may cause unpredictable error.

Fixes: https://tracker.ceph.com/issues/51115
Signed-off-by: yanqiang-ux <yanqiang_ux@163.com>
src/osd/PrimaryLogPG.cc

index fb58df19e3d40fba5d9b1c2c7de1c487fc26efe9..6a1e0123e8974deb98ed487d2888ee3cc5cf3166 100644 (file)
@@ -5286,11 +5286,11 @@ struct FillInVerifyExtent : public Context {
     r(r), rval(rv), outdatap(blp), maybe_crc(mc),
     size(size), osd(osd), soid(soid), flags(flags) {}
   void finish(int len) override {
-    *r = len;
     if (len < 0) {
       *rval = len;
       return;
     }
+    *r = len;
     *rval = 0;
 
     // whole object?  can we verify the checksum?