Skip to content

osd/SnapMapper: fix SnapMapper::Scrubber shard parsing - #65525

Merged
SrinivasaBharath merged 2 commits into
ceph:mainfrom
ethanwu-syno:fix-snapper-parse-m
Oct 10, 2025
Merged

SrinivasaBharath merged 2 commits into
ceph:mainfrom
ethanwu-syno:fix-snapper-parse-m

Conversation

@ethanwu-syno

@ethanwu-syno ethanwu-syno commented Sep 15, 2025 •

Copy link
Copy Markdown
Contributor

From the comment at the beginning of the file
the format for snapshot+obj to obj
should be
SNA_%lld_%llx_.%lx rather than SNA_%lld_%llx.%lx in parse_m

the check for sscanf return value is also incorrect,
it returns the number of input items successfully matched and assigned.

before fix,
we always get shard 255(NO_SHARD)
snap_mapper _parse_m mapping pool 4 snap b shard 255 4:0063648e:::1000000026b.00000000:b
but for erase pool object, it will have shard
snap_mapper _parse_m mapping pool 4 snap b shard 0 4:0063648e:::1000000026b.00000000:b

Fixes: https://tracker.ceph.com/issues/73018

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@ethanwu-syno
ethanwu-syno requested a review from a team as a code owner September 15, 2025 09:09
@github-actions github-actions Bot added the core label Sep 15, 2025
@ronen-fr ronen-fr added the DNM label Sep 15, 2025
@ronen-fr
ronen-fr requested a review from Matan-B September 15, 2025 09:42
@ronen-fr

Copy link
Copy Markdown
Contributor

@Matan-B - can you comment on this (and the probably-wrong tracker)?

@Matan-B Matan-B left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, we should backport this.
Suggesting the following commit message since this area is delicate:

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:

<MAPPING_PREFIX><pool>_<snapid>_.<shardid>_<hobject_t::to_str()>
*******************************^

Or in replicated case:

<MAPPING_PREFIX><pool>_<snapid>_<hobject_t::to_str()>
*******************************^

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 <[email protected]>

Probably a good opportunity to clarify this format nuance in the comments above, I'll edit and cherry-pick here.

@Matan-B Matan-B changed the title OSD/SnapMapper: Fix snapper parse_m SNA key parsing to capture shard osd/SnapMapper: fix SnapMapper::Scrubber shard parsing Sep 17, 2025
@Matan-B
Matan-B requested a review from athanatos September 17, 2025 09:14
@Matan-B Matan-B removed the DNM label Sep 17, 2025
@Matan-B

Matan-B commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

@Matan-B - can you comment on this (and the probably-wrong tracker)?

Thanks for pinging, I've updated the comments as well.

@ethanwu-syno

ethanwu-syno commented Sep 17, 2025 •

Copy link
Copy Markdown
Contributor Author

Great catch, we should backport this. Suggesting the following commit message since this area is delicate:

Update git commit message as suggested, thanks

Comment thread src/osd/SnapMapper.cc Resolved
ethanwu-syno and others added 2 commits September 18, 2025 09:38
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:

<MAPPING_PREFIX><pool>_<snapid>_.<shardid>_<hobject_t::to_str()>
*******************************^

Or in replicated case:

<MAPPING_PREFIX><pool>_<snapid>_<hobject_t::to_str()>
*******************************^

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 <[email protected]>
@amathuria

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants