Skip to content

client: fix ctime advancement on matching atime - #69921

Merged
chrisphoffman merged 2 commits into
ceph:mainfrom
joscollin:wip-71639-client-update-ctime-on-atime-set
Aug 20, 2026
Merged

chrisphoffman merged 2 commits into
ceph:mainfrom
joscollin:wip-71639-client-update-ctime-on-atime-set

Conversation

@joscollin

@joscollin joscollin commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

This PR addresses issues where file access metadata updates were incorrectly optimized away or skipped by the client when exclusive capabilities (CEPH_CAP_FILE_EXCL) were downgraded to SHARED caps in multi-client scenarios.

  • Fix ctime bump on matching atime: Ensures that the client preserves CEPH_SETATTR_ATIME in the network mask and flushes the request to the MDS during an explicit setattr(atime) call under SHARED caps, even if the requested timestamp matches the current cached value. This forces the MDS to receive the request and correctly advance the status change time (ctime) for POSIX compliance.

  • QA Tests: Added dedicated regression test cases (test_ctime_bump_on_matching_atime) in the test suite to validate distributed metadata propagation under SHARED cap constraints.

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

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
joscollin added 2 commits July 2, 2026 19:41
Fix an optimization trap where the client strips CEPH_SETATTR_ATIME
from the setattr mask if the requested atime matches the locally
cached inode atime. The fix ensures that if the client does not
hold EXCL or WR caps, the CEPH_SETATTR_ATIME bit is preserved
in the network mask. This forces the MDS to process the transaction,
allowing it to execute the mandatory ctime advancement.

Fixes: https://tracker.ceph.com/issues/71639
Signed-off-by: Jos Collin <[email protected]>
Orchestrates a multi-client contention scenario using two
mounts to explicitly downgrade client_a down to SHARED caps by reading
from client_b. It then executes a touch/setattr operation on client_a
with an atime value identical to the file's current cached atime.

Verifies that ctime is advanced appropriately by the MDS despite the
value-equality match, preventing future regressions where the client
might strip CEPH_SETATTR_ATIME from the network mask.

Fixes: https://tracker.ceph.com/issues/71639
Signed-off-by: Jos Collin <[email protected]>
@joscollin
joscollin force-pushed the wip-71639-client-update-ctime-on-atime-set branch from 208cd9d to 97eb8c9 Compare July 2, 2026 14:21
@joscollin

Copy link
Copy Markdown
Member Author

jenkins test api

@joscollin
joscollin marked this pull request as ready for review July 3, 2026 02:26
@joscollin
joscollin requested a review from chrisphoffman July 3, 2026 02:27
@vshankar
vshankar requested a review from a team July 7, 2026 06:37

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

Thanks for running the test to validate the fix :).

This looks good to me.

@chrisphoffman

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by choffman started 2026-08-06-18:43.

@chrisphoffman

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by choffman started 2026-08-11-17:22.

@chrisphoffman
chrisphoffman merged commit 41f11ac into ceph:main Aug 20, 2026
6 checks passed
@joscollin
joscollin deleted the wip-71639-client-update-ctime-on-atime-set branch August 20, 2026 14:53
@gregsfortytwo

Copy link
Copy Markdown
Member

I saw this going by in email because of the back ports and some of the context confused me.
The PR looks fine as it goes, but the behavior being changed here originated in d3d1be4 from @xiubli. So I wonder if we have a similar bug in the kclient — did you check that @joscollin @vshankar ?

@gregsfortytwo

Copy link
Copy Markdown
Member

I am a little worried because that patch was part of #43286, which went through a LOT of discussion and review. But that focused on our cap semantics, and I think we just totally neglected that you're supposed to update ctime even on no-op setattrs.
I think that PR introduced the same problem everywhere it checks for equivalence on UID/GID, etc. We should audit and correct that before doing these backports, I think?

@joscollin

Copy link
Copy Markdown
Member Author

Thanks for bringing this up, @gregsfortytwo. You're right about the pattern introduced in #43286.

Since this PR was strictly scoped to address the atime/ctime handling for Tracker#71639 in libcephfs, I will open a new dedicated tracker issue to audit and address no-op setattr ctime updates across the remaining attributes and also check kclient for the similar bug.

I'll defer to you and @vshankar on whether you'd like to pause the backports for Tracker#71639 or let them proceed while we work on the broader audit in the new tracker.

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