Skip to content

tools/cephfs_mirror: Fix dir sync hang - #68128

Merged
vshankar merged 3 commits into
ceph:mainfrom
kotreshhr:mirror-fix-dir-sync-hang
May 12, 2026
Merged

vshankar merged 3 commits into
ceph:mainfrom
kotreshhr:mirror-fix-dir-sync-hang

Conversation

@kotreshhr

@kotreshhr kotreshhr commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

tools/cephfs_mirror: Fix snapshot sync hang

The snapshot mirror sync can hang if all of the following
are true.
1. The snapshot being synced contain only directories and
no files.
2. The crawler finishes syncing dirs and completes crawling
before datasync threads picks it up from syncm queue.

The above scenario can be achieved as below.

 1. Configure say /d0 and /d1 for mirroring.
 2. Create around 10k files in /d0
 3. Create a single dir say /d1/dir0
 4. snapshot /d0 and wait for status to change 'syncing'
 5. Now, snapshot /d1.

The /d1 snapshot will be stuck in syncing, as datasync
thread's has_pending_work logic would never pick it up
as there are no files to be synced (i.e. dataq is empty
and crawl is finished which is essentially job done) and
never notifies crawler thread to proceed with taking
snapshot.

The fix is to pick up the syncm if the crawler is finished
and dataq is empty to avoid missing notification to the
crawler thread.

Fixes: https://tracker.ceph.com/issues/75804
Signed-off-by: Kotresh HR [email protected]

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.

@github-actions github-actions Bot added cephfs Ceph File System tests labels Mar 31, 2026
@kotreshhr
kotreshhr requested review from a team, joscollin and vshankar and removed request for vshankar March 31, 2026 12:34
Comment thread qa/tasks/cephfs/test_mirroring.py Resolved
Comment thread qa/tasks/cephfs/test_mirroring.py Resolved
Comment thread qa/tasks/cephfs/test_mirroring.py Resolved

@joscollin joscollin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Otherwise, looks good to me

@kotreshhr

Copy link
Copy Markdown
Contributor Author

@joscollin I found an issue in checksum calculation when the directory is empty. I will be refreshing the PR in sometime

@kotreshhr
kotreshhr force-pushed the mirror-fix-dir-sync-hang branch from 368167d to 09e16c6 Compare April 6, 2026 09:53
@kotreshhr

Copy link
Copy Markdown
Contributor Author

@joscollin Could you please review and test #67546 before this ?
The configuration introduced by #67546 needs to be disabled for the test added here to reproduce consistently. So #67546 needs to go in first

@joscollin

Copy link
Copy Markdown
Member

@joscollin I found an issue in checksum calculation when the directory is empty. I will be refreshing the PR in sometime

@kotreshhr
Yeah, dir_checksum works only for directory with files in it. I've noticed this before. It's because we have "-type", "f", in the command. I was wondering if there's a better way to change the command options to include directories too if possible.

@kotreshhr

Copy link
Copy Markdown
Contributor Author

@joscollin I found an issue in checksum calculation when the directory is empty. I will be refreshing the PR in sometime

@kotreshhr Yeah, dir_checksum works only for directory with files in it. I've noticed this before. It's because we have "-type", "f", in the command. I was wondering if there's a better way to change the command options to include directories too if possible.

Yes, I fixed it up (09e16c6)

@vshankar
vshankar requested a review from joscollin April 14, 2026 15:31
The snapshot mirror sync can hang if all of the following
are true.
 1. The snapshot being synced contain only directories and
    no files.
 2. The crawler finishes syncing dirs and completes crawling
    before datasync threads picks it up from syncm queue.

The above scenario can be achieved as below.

 1. Configure say /d0 and /d1 for mirroring.
 2. Create around 10k files in /d0
 3. Create a single dir say /d1/dir0
 4. snapshot /d0 and wait for status to change 'syncing'
 5. Now, snapshot /d1.

The /d1 snapshot will be stuck in syncing, as datasync
thread's has_pending_work logic would never pick it up
as there are no files to be synced (i.e. dataq is empty
and crawl is finished which is essentially job done) and
never notifies crawler thread to proceed with taking
snapshot.

The fix is to pick up the syncm if the crawler is finished
and dataq is empty to avoid missing notification to the
crawler thread.

Fixes: https://tracker.ceph.com/issues/75804
Signed-off-by: Kotresh HR <[email protected]>
Comment thread qa/tasks/cephfs/test_mirroring.py Resolved
Comment thread qa/tasks/cephfs/test_mirroring.py Resolved
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@vshankar
vshankar force-pushed the mirror-fix-dir-sync-hang branch from 09e16c6 to f9197b4 Compare April 23, 2026 04:42
@vshankar
vshankar force-pushed the mirror-fix-dir-sync-hang branch from f9197b4 to 683ba28 Compare April 23, 2026 04:46
@vshankar

Copy link
Copy Markdown
Contributor

rebased+updated

@karthik-us1 @joscollin PTAL

@joscollin

Copy link
Copy Markdown
Member

rebased+updated

@karthik-us1 @joscollin PTAL

@vshankar Still there are two unresolved comments. Please check above.

@karthik-us1 karthik-us1 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.

LGTM.

@vshankar

Copy link
Copy Markdown
Contributor

@kotreshhr

Copy link
Copy Markdown
Contributor Author

@joscollin Could you please review and test #67546 before this ? The configuration introduced by #67546 needs to be disabled for the test added here to reproduce consistently. So #67546 needs to go in first

@vshankar I don't this this is taken cared when this is rebased ?

@vshankar

Copy link
Copy Markdown
Contributor

@joscollin Could you please review and test #67546 before this ? The configuration introduced by #67546 needs to be disabled for the test added here to reproduce consistently. So #67546 needs to go in first

@vshankar I don't this this is taken cared when this is rebased ?

Probably I missed that and only fixed up pending comments. Please push an update.

@kotreshhr
kotreshhr force-pushed the mirror-fix-dir-sync-hang branch from 683ba28 to 3ea2d45 Compare April 28, 2026 07:51
@kotreshhr

Copy link
Copy Markdown
Contributor Author

@joscollin Could you please review and test #67546 before this ? The configuration introduced by #67546 needs to be disabled for the test added here to reproduce consistently. So #67546 needs to go in first

@vshankar I don't this this is taken cared when this is rebased ?

Probably I missed that and only fixed up pending comments. Please push an update.

Done

@vshankar vshankar 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.

@vshankar
vshankar merged commit 6f7b98a into ceph:main May 12, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/25744455693

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.

4 participants