From: ethanwu Date: Mon, 15 Sep 2025 08:36:54 +0000 (+0800) Subject: osd/SnapMapper: fix SnapMapper::Scrubber pg shard parsing X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9dda7afd8d851f1424e4a819aaf0d41e29fb749f;p=ceph.git osd/SnapMapper: fix SnapMapper::Scrubber pg shard parsing Note: the following only applies to EC pools as replicated pools have no shard in the SNA_ keys. Note: The Scrubber is only responsible for clearing entries that (_for some anomalous reason_) remained in the store and should have been purged. SnapMapper::Scrubber::_parse_m is using the wrong key format (See: napMapper::get_prefix) to obtain the pg shard. While the correct format in EC pgs is: __._ *******************************^ Or in replicated case: __ *******************************^ The Scrubber is parsing the key a `.` instead of `_`. --- `sscanf` should return the 3 if the third parameter (shard) was successfully parsed. Otherwise, we assume no shard is present in this key. Fixes: https://tracker.ceph.com/issues/73018 Signed-off-by: ethanwu --- diff --git a/src/osd/SnapMapper.cc b/src/osd/SnapMapper.cc index 2f22ea9c9ee17..d9d27dfabc692 100644 --- a/src/osd/SnapMapper.cc +++ b/src/osd/SnapMapper.cc @@ -976,8 +976,8 @@ bool SnapMapper::Scrubber::_parse_m( { unsigned long long p, s; long sh; - int r = sscanf(key.data(), "SNA_%lld_%llx.%lx", &p, &s, &sh); - if (r != 1) { + int r = sscanf(key.data(), "SNA_%lld_%llx_.%lx", &p, &s, &sh); + if (r != 3) { shard = shard_id_t::NO_SHARD; } else { shard = shard_id_t(sh);