From: xiexingguo <258156334@qq.com> Date: Tue, 22 Dec 2015 09:05:06 +0000 (+0800) Subject: ReplicatedPG: fix sparse-read result code checking logic X-Git-Tag: v10.0.3~147^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b3aa29e324cf0a96a1f2f5dcf1ba998219457bcd;p=ceph.git ReplicatedPG: fix sparse-read result code checking logic 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 9d1639a518d1..f3c767c3a2e5 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4185,6 +4185,11 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& 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& 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.