Skip to content

mds/snapdiff: snapdiff doesn't report modified files - #69895

Merged
vshankar merged 3 commits into
ceph:mainfrom
kotreshhr:mds-snapdiff-snapflush-issue
Sep 21, 2026
Merged

vshankar merged 3 commits into
ceph:mainfrom
kotreshhr:mds-snapdiff-snapflush-issue

Conversation

@kotreshhr

@kotreshhr kotreshhr commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

The snapdiff doesn't report files which are modified in following case

  1. If the modified files between two snapshots has snap flush pending from clients
    The following upstream teuthology tests caught this.
    a. test_cephfs_mirror_incremental_sync
    b. test_cephfs_mirror_sync_with_purged_snapshot

The PR takes care of fixing them.

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

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 Jul 2, 2026
@kotreshhr
kotreshhr requested review from a team and vshankar July 2, 2026 04:10
Comment thread src/mds/Server.cc Resolved
@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from c64869e to 88fe270 Compare July 17, 2026 05:32
@vshankar

Copy link
Copy Markdown
Contributor

PR #68054 adds functionality to specify mask for file attribute changes. I haven't reviewed it yet, but it seems like the changes introduced in that PR to specify mask params is probably a bit more flexible.

@vshankar vshankar self-assigned this Jul 21, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 18:35
@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 88fe270 to 812b377 Compare July 29, 2026 18:35

Copilot AI 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.

Pull request overview

Updates MDS snapdiff handling to wait for client snap flushes and re-enables CephFS mirroring integration tests.

Changes:

  • Synchronizes inode metadata before snapdiff comparisons.
  • Defers replies while snap flushes are pending.
  • Re-enables two mirroring tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/mds/Server.h Extends the snapdiff helper API with waiting state.
src/mds/Server.cc Adds snap-flush synchronization and metadata comparisons.
qa/tasks/cephfs/test_mirroring.py Re-enables affected mirroring tests.
Comments suppressed due to low confidence (1)

src/mds/Server.cc:12660

  • Equal mtime is still treated as proof that the file is unchanged. A client can overwrite same-sized data and restore the original timestamp; writes increment change_attr (src/client/Client.cc:12291-12295) and snap flush imports it (src/mds/Locker.cc:3979-3984), but this comparison ignores it and drops the file from snapdiff. Compare a write-sensitive snapshot attribute after synchronization rather than relying only on mtime.
	      if (mtime == before.mtime) {

Comment thread src/mds/Server.cc Resolved
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

@kotreshhr

Copy link
Copy Markdown
Contributor Author

Sample run - https://pulpito-ng.ceph.com/runs/khiremat-2026-08-11_11:02:21-fs-wip-khiremat-snapdiff-snapflush-bug-11082026-distro-default-trial

The snapdiff duration with the fix. Observe increment_duration2

khiremat@trial200:/teuthology/khiremat-2026-08-11_11:02:21-fs-wip-khiremat-snapdiff-snapflush-bug-11082026-distro-default-trial$ grep "full_sync_duration" */teuthology.log
456477/teuthology.log:2026-08-11T13:32:48.160 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 12.0, inc_sync_duration1 - 6.0
456477/teuthology.log:2026-08-11T13:33:24.879 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 12.0, inc_sync_duration2 - 21.0
456478/teuthology.log:2026-08-11T13:32:24.254 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 14.0, inc_sync_duration1 - 6.0
456478/teuthology.log:2026-08-11T13:33:00.105 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 14.0, inc_sync_duration2 - 17.0
456479/teuthology.log:2026-08-11T13:32:46.386 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 13.0, inc_sync_duration1 - 6.0
456479/teuthology.log:2026-08-11T13:33:23.096 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 13.0, inc_sync_duration2 - 21.0
456480/teuthology.log:2026-08-11T13:32:48.924 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 16.0, inc_sync_duration1 - 5.0
456480/teuthology.log:2026-08-11T13:33:25.017 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 16.0, inc_sync_duration2 - 18.0
456481/teuthology.log:2026-08-11T13:32:25.668 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 15.0, inc_sync_duration1 - 9.0
456481/teuthology.log:2026-08-11T13:33:01.993 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 15.0, inc_sync_duration2 - 18.0
456487/teuthology.log:2026-08-11T13:47:37.221 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456487/teuthology.log:2026-08-11T13:48:17.467 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456488/teuthology.log:2026-08-11T13:49:00.471 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 13.0
456488/teuthology.log:2026-08-11T13:49:40.099 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 24.0
456489/teuthology.log:2026-08-11T13:48:02.538 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456489/teuthology.log:2026-08-11T13:48:42.248 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456490/teuthology.log:2026-08-11T13:47:19.346 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456490/teuthology.log:2026-08-11T13:47:58.913 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456491/teuthology.log:2026-08-11T13:48:13.076 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 21.0, inc_sync_duration1 - 10.0
456491/teuthology.log:2026-08-11T13:48:52.602 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 21.0, inc_sync_duration2 - 21.0

Comparing the same with the sample tentacle run without multithreaded mirroring - https://pulpito-ng.ceph.com/runs/khiremat-2026-08-11_15:29:17-fs-wip-khiremat-mirror-backports-tentacle-10082026-distro-default-trial
Note that I had the this log change

khiremat@trial200:/teuthology/khiremat-2026-08-11_15:29:17-fs-wip-khiremat-mirror-backports-tentacle-10082026-distro-default-trial$ grep "full_sync_duration" */teuthology.log
457492/teuthology.log:2026-08-11T16:06:29.098 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 19.0, inc_sync_duration1 - 16.0
457492/teuthology.log:2026-08-11T16:07:14.827 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 19.0, inc_sync_duration2 - 14.0
457493/teuthology.log:2026-08-11T16:06:22.349 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration1 - 11.0
457493/teuthology.log:2026-08-11T16:07:18.448 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration2 - 13.0
457494/teuthology.log:2026-08-11T16:07:01.481 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 20.0, inc_sync_duration1 - 16.0
457494/teuthology.log:2026-08-11T16:07:47.193 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 20.0, inc_sync_duration2 - 17.0
457495/teuthology.log:2026-08-11T16:07:09.866 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration1 - 6.0
457495/teuthology.log:2026-08-11T16:08:05.575 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration2 - 16.0
457496/teuthology.log:2026-08-11T16:06:34.190 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 18.0, inc_sync_duration1 - 6.0
457496/teuthology.log:2026-08-11T16:07:30.144 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 18.0, inc_sync_duration2 - 16.0
457502/teuthology.log:2026-08-11T16:16:46.770 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
457502/teuthology.log:2026-08-11T16:17:26.428 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 21.0
457503/teuthology.log:2026-08-11T16:17:02.551 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
457503/teuthology.log:2026-08-11T16:17:42.212 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 21.0
457504/teuthology.log:2026-08-11T16:16:56.626 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 9.0
457504/teuthology.log:2026-08-11T16:17:36.596 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 21.0
457505/teuthology.log:2026-08-11T16:16:57.587 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 9.0
457505/teuthology.log:2026-08-11T16:17:37.341 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 20.0
457506/teuthology.log:2026-08-11T16:16:09.330 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 11.0
457506/teuthology.log:2026-08-11T16:16:48.693 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 21.0

@vshankar

Copy link
Copy Markdown
Contributor

Sample run - https://pulpito-ng.ceph.com/runs/khiremat-2026-08-11_11:02:21-fs-wip-khiremat-snapdiff-snapflush-bug-11082026-distro-default-trial

The snapdiff duration with the fix. Observe increment_duration2

khiremat@trial200:/teuthology/khiremat-2026-08-11_11:02:21-fs-wip-khiremat-snapdiff-snapflush-bug-11082026-distro-default-trial$ grep "full_sync_duration" */teuthology.log
456477/teuthology.log:2026-08-11T13:32:48.160 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 12.0, inc_sync_duration1 - 6.0
456477/teuthology.log:2026-08-11T13:33:24.879 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 12.0, inc_sync_duration2 - 21.0
456478/teuthology.log:2026-08-11T13:32:24.254 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 14.0, inc_sync_duration1 - 6.0
456478/teuthology.log:2026-08-11T13:33:00.105 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 14.0, inc_sync_duration2 - 17.0
456479/teuthology.log:2026-08-11T13:32:46.386 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 13.0, inc_sync_duration1 - 6.0
456479/teuthology.log:2026-08-11T13:33:23.096 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 13.0, inc_sync_duration2 - 21.0
456480/teuthology.log:2026-08-11T13:32:48.924 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 16.0, inc_sync_duration1 - 5.0
456480/teuthology.log:2026-08-11T13:33:25.017 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 16.0, inc_sync_duration2 - 18.0
456481/teuthology.log:2026-08-11T13:32:25.668 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 15.0, inc_sync_duration1 - 9.0
456481/teuthology.log:2026-08-11T13:33:01.993 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 15.0, inc_sync_duration2 - 18.0
456487/teuthology.log:2026-08-11T13:47:37.221 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456487/teuthology.log:2026-08-11T13:48:17.467 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456488/teuthology.log:2026-08-11T13:49:00.471 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 13.0
456488/teuthology.log:2026-08-11T13:49:40.099 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 24.0
456489/teuthology.log:2026-08-11T13:48:02.538 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456489/teuthology.log:2026-08-11T13:48:42.248 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456490/teuthology.log:2026-08-11T13:47:19.346 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
456490/teuthology.log:2026-08-11T13:47:58.913 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 22.0
456491/teuthology.log:2026-08-11T13:48:13.076 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 21.0, inc_sync_duration1 - 10.0
456491/teuthology.log:2026-08-11T13:48:52.602 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 21.0, inc_sync_duration2 - 21.0

Comparing the same with the sample tentacle run without multithreaded mirroring - https://pulpito-ng.ceph.com/runs/khiremat-2026-08-11_15:29:17-fs-wip-khiremat-mirror-backports-tentacle-10082026-distro-default-trial Note that I had the this log change

khiremat@trial200:/teuthology/khiremat-2026-08-11_15:29:17-fs-wip-khiremat-mirror-backports-tentacle-10082026-distro-default-trial$ grep "full_sync_duration" */teuthology.log
457492/teuthology.log:2026-08-11T16:06:29.098 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 19.0, inc_sync_duration1 - 16.0
457492/teuthology.log:2026-08-11T16:07:14.827 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 19.0, inc_sync_duration2 - 14.0
457493/teuthology.log:2026-08-11T16:06:22.349 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration1 - 11.0
457493/teuthology.log:2026-08-11T16:07:18.448 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration2 - 13.0
457494/teuthology.log:2026-08-11T16:07:01.481 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 20.0, inc_sync_duration1 - 16.0
457494/teuthology.log:2026-08-11T16:07:47.193 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 20.0, inc_sync_duration2 - 17.0
457495/teuthology.log:2026-08-11T16:07:09.866 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration1 - 6.0
457495/teuthology.log:2026-08-11T16:08:05.575 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 17.0, inc_sync_duration2 - 16.0
457496/teuthology.log:2026-08-11T16:06:34.190 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 18.0, inc_sync_duration1 - 6.0
457496/teuthology.log:2026-08-11T16:07:30.144 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 18.0, inc_sync_duration2 - 16.0
457502/teuthology.log:2026-08-11T16:16:46.770 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
457502/teuthology.log:2026-08-11T16:17:26.428 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 21.0
457503/teuthology.log:2026-08-11T16:17:02.551 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 11.0
457503/teuthology.log:2026-08-11T16:17:42.212 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 21.0
457504/teuthology.log:2026-08-11T16:16:56.626 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 9.0
457504/teuthology.log:2026-08-11T16:17:36.596 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 21.0
457505/teuthology.log:2026-08-11T16:16:57.587 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration1 - 9.0
457505/teuthology.log:2026-08-11T16:17:37.341 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 22.0, inc_sync_duration2 - 20.0
457506/teuthology.log:2026-08-11T16:16:09.330 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration1 - 11.0
457506/teuthology.log:2026-08-11T16:16:48.693 DEBUG:tasks.cephfs.test_mirroring:full_sync_duration - 23.0, inc_sync_duration2 - 21.0

This is effectively 2x the latency :/

@vshankar

Copy link
Copy Markdown
Contributor

@kotreshhr - change seems reasonable. I will run this through tests to assess once more.

@vshankar

Copy link
Copy Markdown
Contributor

jenkins test windows

2 similar comments
@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 02b8bc6 to 7c55e6f Compare August 31, 2026 19:05
@kotreshhr

Copy link
Copy Markdown
Contributor Author

Rebased to fix jenkins windows test

@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@kotreshhr

Copy link
Copy Markdown
Contributor Author

make check and windows ci job failed because of
unittest_librbd crash in TestIOWithIOHint
ceph_test_librbd.TestMigration.SnapsSnapExpandAfterPrepare

Not related to snapdiff libcephfs test as earlier

@vshankar

vshankar commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Refreshed the PR by adding snap flush pending check for mtime matching case as well to avoid taking rdlock

Sounds good. Will run through tests.

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 67582d9 to 9689b60 Compare September 4, 2026 09:45
@kotreshhr

Copy link
Copy Markdown
Contributor Author

Rebased because of merge conflict

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 9689b60 to a3556a4 Compare September 4, 2026 09:50
@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@kotreshhr

Copy link
Copy Markdown
Contributor Author

jenkins test api

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch 2 times, most recently from 23351dd to 2e20ff5 Compare September 7, 2026 04:13
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

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

Problem:
readdir_snapdiff walks directory dentries and compares file mtimes
between two snapshots to decide which entries changed.  When a client
still has dirty snap caps, metadata writeback (snapflush) may be in
progress on the HEAD inode.  In that window both the snap-side and
HEAD-side inodes can expose the same stale mtime, so build_snap_diff
incorrectly treats the file as unchanged and omits it from the diff.

Testcase:
This showed up in cephfs-mirror incremental sync: after modifying files
(e.g. git pull) and taking a new snapshot, snapdiff(snap_b, snap_c)
returned no entries for files that had actually changed, leaving the
secondary missing updates such as .git/logs/HEAD. The tests that
were failing were test_cephfs_mirror_incremental_sync and
test_cephfs_mirror_sync_with_purged_snapshot

Fix:
Wait for snapflush before trusting an equal-mtime comparison, matching
the snapped-read path in handle_client_open which rdlocks the child
filelock so writers flush before metadata is read.

Changes:
- Add an optional `waiting` out-parameter to build_snap_diff.  When
  snapflush blocks, set it and return without finishing the RPC;
  _readdir_diff drops the partial reply and the existing
  C_MDS_RetryRequest path retries once the lock is available.
- Introduce rdlock_file_mtime() using rdlock_start/rdlock_finish on the
  child filelock.
- Only rdlock when comparing a before/after dentry pair with the same
  ino and equal unlocked mtimes -- the case where snapflush may still
  be hiding a real change.  If unlocked mtimes already differ, include
  the file immediately with no lock.  Store the before mtime without
  locking; rdlock only the later (typically HEAD) inode in the pair.

Fixes: https://tracker.ceph.com/issues/74984
Signed-off-by: Kotresh HR <[email protected]>
@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 2e20ff5 to ed0b33f Compare September 7, 2026 05:13
@kotreshhr

Copy link
Copy Markdown
Contributor Author

@vshankar I think the merge conflict resolution needs to be done carefully. I will take one more look. please don't merge

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from ed0b33f to 4427b75 Compare September 7, 2026 15:13
When a dentry spans both snapid_prev and snapid, build_snap_diff skips
it without comparing metadata.  If snapflush is still outstanding, that
skip can hide a real change.

Add snapflush_pending() using client_snap_caps on snap inodes and
client_need_snapflush on HEAD for snaps in [snapid_prev, snapid].
When snapflush is pending, rdlock the filelock first so metadata
comparisons run on flushed state, then apply the multiversion hardlink
and mtime checks from PR ceph#70953.

For the dentry pair compare path, only rdlock when snapflush is pending
instead of always rdlocking on equal unlocked metadata.

Fixes: https://tracker.ceph.com/issues/74984
Signed-off-by: Kotresh HR <[email protected]>
@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 4427b75 to 1ebbf45 Compare September 7, 2026 18:49
@kotreshhr

Copy link
Copy Markdown
Contributor Author

@vshankar I think the merge conflict resolution needs to be done carefully. I will take one more look. please don't merge

@vshankar I have carefully done the conflict resolution so that both the multiversion case and snap flush pending case is handled. pedal

Include the following skipped tests back since
the bug is fixed.

test_cephfs_mirror_incremental_sync
test_cephfs_mirror_sync_with_purged_snapshot

Also remove the assert check which validates
full sync time to be greater than incremental
sync time. With separate crawler thread introduced
with multi-threaded mirroring, for a few thousand
files, full sync is faster than using snapdiff

Also, add evicting unrepsonsive client warning
to ignore list for both valgrind and normal runs
as it's expected in fs:mirror as a result of
commit 518edfe

Fixes: https://tracker.ceph.com/issues/74984
Signed-off-by: Kotresh HR <[email protected]>
@kotreshhr

Copy link
Copy Markdown
Contributor Author

Sample mirror qa run with the rebased changes -
https://pulpito-ng.ceph.com/runs/khiremat-2026-09-08_04:55:11-fs-wip-khiremat-69895-snapdiff-08092026-distro-default-trial

@vshankar The run looks good but required a warning 'evicting unresponsive clients' to be added to ignore list of valgrind mirror suite as well. I was only added to run without valgrind. I will refresh the PR adding that.

@kotreshhr
kotreshhr force-pushed the mds-snapdiff-snapflush-issue branch from 1ebbf45 to 5489bf4 Compare September 8, 2026 10:04
@kotreshhr

Copy link
Copy Markdown
Contributor Author

Sample mirror qa run with the rebased changes - https://pulpito-ng.ceph.com/runs/khiremat-2026-09-08_04:55:11-fs-wip-khiremat-69895-snapdiff-08092026-distro-default-trial

@vshankar The run looks good but required a warning 'evicting unresponsive clients' to be added to ignore list of valgrind mirror suite as well. I was only added to run without valgrind. I will refresh the PR adding that.

Done - 5489bf4#diff-893142109427b64c905a19b784351bef3cee9c627408245ef716bd7d0acc62dfR35

@vshankar

Copy link
Copy Markdown
Contributor

This change is good to merge as the mirror dameon tests have passed. See: https://pulpito.ceph.com/vshankar-2026-09-18_14:09:51-fs-wip-vshankar-testing-20260916.092455-distro-default-trial/

However, there is still a corner case in snapdiff that could cause it to miss reporting file. See: https://tracker.ceph.com/issues/80634

I have a fix for the above tracker and it's based on top of this change.

@vshankar
vshankar merged commit 9d54cc8 into ceph:main Sep 21, 2026
14 checks passed
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