]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: fix sparse-read result code checking logic 7016/head
authorxiexingguo <258156334@qq.com>
Tue, 22 Dec 2015 09:05:06 +0000 (17:05 +0800)
committerxiexingguo <258156334@qq.com>
Tue, 22 Dec 2015 09:05:06 +0000 (17:05 +0800)
Move ahead the result code checking logic before we continue to verify the trailing hole, otherwise
the real result of non-hole reading may be overwritten and thus confuse caller.

Fixes: #14151
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/ReplicatedPG.cc

index 9d1639a518d1519a96e6712dc7505cc010e9ba7a..f3c767c3a2e52f89daefe205af0c46a80b4325e6 100644 (file)
@@ -4185,6 +4185,11 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          data_bl.claim_append(tmpbl);
          last = miter->first + r;
         }
+        
+        if (r < 0) {
+          result = r;
+          break;
+        }
 
        // verify trailing hole?
        if (cct->_conf->osd_verify_sparse_read_holes) {
@@ -4200,11 +4205,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          }
        }
 
-        if (r < 0) {
-          result = r;
-          break;
-        }
-
        // Why SPARSE_READ need checksum? In fact, librbd always use sparse-read. 
        // Maybe at first, there is no much whole objects. With continued use, more and more whole object exist.
        // So from this point, for spare-read add checksum make sense.