Skip to content

mds scrub fix#5

Open
sajibreadd-croit wants to merge 1 commit intocroit-ceph-v18.2.4from
washu-scrub-fix-v18.2.4
Open

mds scrub fix#5
sajibreadd-croit wants to merge 1 commit intocroit-ceph-v18.2.4from
washu-scrub-fix-v18.2.4

Conversation

@sajibreadd-croit
Copy link

  1. remote link damage identification with reverse parent scrubbing
    • remote link identification becomes tricky if inode is cached.
    • Try to open the link normally, if issue while opening mark as damaged
    • If openned successfully, it can be possible there is damage but inode is cached that's why it is succssful while opening. In that case take that openned inode, and scrub ancestors recursively. If any of the ancestor is damaged it remote link is marked as damaged.
    • while scrubbing some flag is maintained in the inode, e.g. whether scrub is backward or forward or both
    • his backward scrubbing will only work in read-only scrub that means without repair flag and mds_scrub_hard_link this ceph flag is turned on.
    • A new type of damage introduced, using which multiple links point to same inode can be identified, which was not possible previously.
  2. mds_damage_log_to_file and mds_damage_log_file is used to print out damages in a file persistently as it's not safe to keep it in memory
  3. missing dirfrag can make scrub recurring, so a flag from_scrub is used to identify when dirfrag fetch is from scrub function.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

   - remote link identification becomes tricky if inode is cached.
   - Try to open the link normally, if issue while opening mark as damaged
   - If openned successfully, it can be possible there is damage but inode
     is cached that's why it is succssful while opening. In that case take
     that openned inode, and scrub ancestors recursively. If any of the ancestor
     is damaged it remote link is marked as damaged.
   - while scrubbing some flag is maintained in the inode,
     e.g. whether scrub is backward or forward or both
   - his backward scrubbing will only work in read-only scrub that means
     without repair flag and mds_scrub_hard_link this ceph flag is turned on.
   - A new type of damage introduced, using which multiple links point to same
     inode can be identified, which was not possible previously.
2. mds_damage_log_to_file and mds_damage_log_file is used to print out damages
   in a file persistently as it's not safe to keep it in memory
3. missing dirfrag can make scrub recurring, so a flag `from_scrub` is used to identify when
   dirfrag fetch is from scrub function.

Fixes: https://tracker.ceph.com/issues/68611
Signed-off-by: Md Mahamudur Rahaman Sajib <mahamudur.sajib@croit.io>
} else if (dir->get_version() == 0) {
dout(20) << __func__ << " barebones " << *dir << dendl;
dir->fetch_keys({}, gather.new_sub());
dir->fetch_keys({}, gather.new_sub(), true);
Copy link

Choose a reason for hiding this comment

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

This (plus all the changes in CDir.*) look like a pretty independent fix, IMO better to make a standalone commit for that.

add_remote_link_damage(remote_link_path, remote_ino);
header->inc_scrubbed_remote_link_count();
}
in->scrub_reset_remote_links();
Copy link

Choose a reason for hiding this comment

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

redundant, scrub_finished() does reset on its own.

add_remote_link_damage(remote_link_path, remote_ino);
header->inc_scrubbed_remote_link_count();
}
in->scrub_reset_remote_links();
Copy link

Choose a reason for hiding this comment

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

redundant, scrub_finished() does reset on its own.

void CInode::scrub_add_remote_link(
std::vector<std::pair<std::string, inodeno_t>> &&remote_links) {

for (auto& [remote_link_path, remote_ino]: remote_links) {
Copy link

Choose a reason for hiding this comment

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

Why not using a whole pair:
for (auto& p : remote_links) {
emplace_back(std::move(p));
}

if (done) {
dout(20) << __func__ << " dir inode, done" << dendl;
in->set_forward_scrub(false);
dequeue(in);
Copy link

Choose a reason for hiding this comment

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

Shouldn't we call scrub_dir_inode_final(in) here if (!remote_links().empty()) ?

log_to_file = _log_to_file;
if (log_to_file) {
log_file_opened = open_damage_log_file(fout, log_file);
}
Copy link

Choose a reason for hiding this comment

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

For the sake of completeness IMO better to timplement log file close as well.

void set_log_to_file(bool _log_to_file) {
log_to_file = _log_to_file;
if (log_to_file) {
log_file_opened = open_damage_log_file(fout, log_file);
Copy link

Choose a reason for hiding this comment

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

IMO log_file_opened better to be assigned inside open_damage_log_file (and symetric close method if any).

remote_links.erase(df_remote_link_it);
}
}
remote_links.erase(remote_link_entry->ino);
Copy link

Choose a reason for hiding this comment

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

Apparently either this one or above remote_links.erase() call is redundant

if (df_remote_link_it != remote_links.end()) {
auto damage_it = df_remote_link_it->second.find(entry->path);
if (damage_it != df_remote_link_it->second.end()) {
df_remote_link_it->second.erase(entry->path);
Copy link

Choose a reason for hiding this comment

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

Why not using damage_it for erase() call?

starttime(mono_clock::now()),
ioc(ioc)
{
MDSRank::MDSRank(mds_rank_t whoami_, ceph::fair_mutex &mds_lock_,
Copy link

Choose a reason for hiding this comment

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

IMO the original version was better readable...

@sajibreadd-croit sajibreadd-croit mentioned this pull request Dec 19, 2025
14 tasks
@ifed01
Copy link

ifed01 commented Jan 13, 2026

@sajibreadd - this can be closed in favor of #6, right?

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.

3 participants