From 1ab2b481596ad5296e168bf8027e59d41190176e Mon Sep 17 00:00:00 2001 From: xiexingguo <258156334@qq.com> Date: Tue, 22 Dec 2015 17:05:06 +0800 Subject: [PATCH] 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 (cherry picked from commit b3aa29e324cf0a96a1f2f5dcf1ba998219457bcd) Conflicts: src/osd/ReplicatedPG.cc: trivial resolution --- src/osd/ReplicatedPG.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index b255b9fa6aaa0..835fc2fceb22f 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3575,6 +3575,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) { @@ -3590,11 +3595,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) } } - if (r < 0) { - result = r; - break; - } - op.extent.length = total_read; ::encode(m, osd_op.outdata); -- 2.39.5