From e65c1d7095a314665c41dbd3e5e930a8ee284fdb Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 30 Sep 2018 22:25:49 +0800 Subject: [PATCH] osd/ECBackend: don't get result code of subchunk-read overwritten Fixes: http://tracker.ceph.com/issues/21769 Signed-off-by: songweibin (cherry picked from commit 4692f995ba6967796d5dd2f5fd85fde8705a1ccc) Conflicts: src/osd/ECBackend.cc: master contains changes from 33d79f303d945c8d6d2e9e9a471efc4df57617a6, but luminous does, so we don't need to consider the case of fragmented read. --- src/osd/ECBackend.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 23e5a50f0166c..fef3c03d1514b 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -1000,17 +1000,6 @@ void ECBackend::handle_sub_read( i != op.to_read.end(); ++i) { int r = 0; - ECUtil::HashInfoRef hinfo; - if (!get_parent()->get_pool().allows_ecoverwrites()) { - hinfo = get_hash_info(i->first); - if (!hinfo) { - r = -EIO; - get_parent()->clog_error() << "Corruption detected: object " << i->first - << " is missing hash_info"; - dout(5) << __func__ << ": No hinfo for " << i->first << dendl; - goto error; - } - } for (auto j = i->second.begin(); j != i->second.end(); ++j) { bufferlist bl; r = store->read( @@ -1039,6 +1028,17 @@ void ECBackend::handle_sub_read( // This shows that we still need deep scrub because large enough files // are read in sections, so the digest check here won't be done here. // Do NOT check osd_read_eio_on_bad_digest here. We need to report + ECUtil::HashInfoRef hinfo; + if (!get_parent()->get_pool().allows_ecoverwrites()) { + hinfo = get_hash_info(i->first); + if (!hinfo) { + r = -EIO; + get_parent()->clog_error() << "Corruption detected: object " << i->first + << " is missing hash_info"; + dout(5) << __func__ << ": No hinfo for " << i->first << dendl; + goto error; + } + } // the state of our chunk in case other chunks could substitute. assert(hinfo->has_chunk_hash()); if ((bl.length() == hinfo->get_total_chunk_size()) && -- 2.39.5