From db8d185288d0e9602f654c89b7f18f8be45de3d0 Mon Sep 17 00:00:00 2001 From: Zhansong Gao Date: Sun, 11 Dec 2022 21:40:41 +0800 Subject: [PATCH] osd/scrub: add a variable to store osd_deep_scrub_stride Use another variable to store the value of osd_deep_scrub_stride for later use because osd_deep_scrub_stride can be modified on the fly, otherwise we may get an incorrect digest value that contains only part of the object data when osd_deep_scrub_stride is modified and it will make pg inconsistent. Fixes: https://tracker.ceph.com/issues/58240 Signed-off-by: Zhansong Gao --- src/osd/ReplicatedBackend.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 22bf4aea0f5f7..2cae2ce2428be 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -653,13 +653,15 @@ int ReplicatedBackend::be_deep_scrub( pos.data_hash = bufferhash(-1); } + const uint64_t stride = cct->_conf->osd_deep_scrub_stride; + bufferlist bl; r = store->read( ch, ghobject_t( poid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard), pos.data_pos, - cct->_conf->osd_deep_scrub_stride, bl, + stride, bl, fadvise_flags); if (r < 0) { dout(20) << __func__ << " " << poid << " got " @@ -671,7 +673,7 @@ int ReplicatedBackend::be_deep_scrub( pos.data_hash << bl; } pos.data_pos += r; - if (static_cast(r) == cct->_conf->osd_deep_scrub_stride) { + if (static_cast(r) == stride) { dout(20) << __func__ << " " << poid << " more data, digest so far 0x" << std::hex << pos.data_hash.digest() << std::dec << dendl; return -EINPROGRESS; -- 2.39.5