]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: add a variable to store osd_deep_scrub_stride 49379/head
authorZhansong Gao <zhsgao@hotmail.com>
Sun, 11 Dec 2022 13:40:41 +0000 (21:40 +0800)
committerZhansong Gao <zhsgao@hotmail.com>
Wed, 14 Dec 2022 10:49:03 +0000 (18:49 +0800)
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 <zhsgao@hotmail.com>
src/osd/ReplicatedBackend.cc

index 22bf4aea0f5f723dd7e90d99bcfb284315bba9c7..2cae2ce2428be1335a8e75b1295d617a72553216 100644 (file)
@@ -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<uint64_t>(r) == cct->_conf->osd_deep_scrub_stride) {
+    if (static_cast<uint64_t>(r) == stride) {
       dout(20) << __func__ << "  " << poid << " more data, digest so far 0x"
               << std::hex << pos.data_hash.digest() << std::dec << dendl;
       return -EINPROGRESS;