From b4eed7b9f5ec611471068eae7e5ed229911cfbaa Mon Sep 17 00:00:00 2001 From: yanqiang-ux Date: Mon, 7 Jun 2021 15:54:44 +0800 Subject: [PATCH] osd: set r only if succeed in FillInVerifyExtent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 127745161fbcdee06b2dfa8464270c3934bcd06a) --- src/osd/PrimaryLogPG.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 339b262b60b0..ec9a5d37c74e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5187,11 +5187,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? -- 2.47.3