Bug #71639
closedlibcephfs fails to update ctime post an update to atime with same timestamp
0%
Description
In a scenario where multiple cephfs clients keeps open file handles to the same file, an explicit update to atime doesn't update ctime. Please see the attached standalone reproducer based on specific test from smbtorture suite which is causing failures as described in https://github.com/samba-in-kubernetes/sit-test-cases/issues/101.
# gcc -D_FILE_OFFSET_BITS=64 -L/usr/local/lib -lcephfs libcephfs_fh_ctime.c
# ./a.out
Usage: ./a.out <client-id> <conf-file> <filesystem> <file> <multi-client>
# ./a.out foo /etc/ceph/ceph.conf cephvol test.dat 0
file create
atime = 2025-06-11 19:28:45.050263229
ctime = 2025-06-11 19:28:45.050263229
setattr atime
atime = 2025-06-11 19:28:45.050263229
ctime = 2025-06-11 19:28:45.054957062
# ./a.out foo /etc/ceph/ceph.conf cephvol test.dat 1
file create
atime = 2025-06-11 19:28:47.365038654
ctime = 2025-06-11 19:28:47.365038654
setattr atime
atime = 2025-06-11 19:28:47.365038654
ctime = 2025-06-11 19:28:47.365038654
Additional information:
- The misbehaviour is only visible when same timestamp is used for atime update.
- A second client need not perform any operation other than opening a file handle.
Files
AC Updated by Anoop C S over 1 year ago
- Subject changed from libcephfs fails to update ctime post an update to atime to libcephfs fails to update ctime post an update to atime with same timestamp
AC Updated by Anoop C S over 1 year ago
Here's the expectation defined in utimensat(2) man page:
The status change time (ctime) will be set to the current time, even if the other time stamps don't actually change.
To be clear, the other timestamps here corresponds to atime and mtime.
VS Updated by Venky Shankar over 1 year ago
- Category set to Correctness/Safety
- Status changed from New to Triaged
- Assignee set to Venky Shankar
- Target version set to v21.0.0
- Source set to Community (user)
- Backport set to tentacle,squid,reef
Anoop C S wrote:
In a scenario where multiple cephfs clients keeps open file handles to the same file, an explicit update to atime doesn't update ctime. Please see the attached standalone reproducer based on specific test from smbtorture suite which is causing failures as described in https://github.com/samba-in-kubernetes/sit-test-cases/issues/101.
[...]
Additional information:
- The misbehaviour is only visible when same timestamp is used for atime update.
Oh, the client library probably update ctime only when atime changes. This is a bug. Thx for reporting!
- A second client need not perform any operation other than opening a file handle.
AC Updated by Anoop C S over 1 year ago
Venky Shankar wrote in #note-3:
Anoop C S wrote:
Additional information:
- The misbehaviour is only visible when same timestamp is used for atime update.
Oh, the client library probably update ctime only when atime changes. This is a bug. Thx for reporting!
With a single client it works as expected i.e, ctime gets updated even with same timestamp for atime. But as soon as a second client appears with an open file handle to the same file it fails to update ctime. That's the last switch I've included in the reproducer to control the multi-client behaviour.
You may have to run the reproducer (single and multi-client) in a loop to see the change in behaviour because at times ctime gets updated in multi-client scenario. But in single client use case ctime is always updated without any fail.
VS Updated by Venky Shankar over 1 year ago
Anoop C S wrote in #note-4:
Venky Shankar wrote in #note-3:
Anoop C S wrote:
Additional information:
- The misbehaviour is only visible when same timestamp is used for atime update.
Oh, the client library probably update ctime only when atime changes. This is a bug. Thx for reporting!
With a single client it works as expected i.e, ctime gets updated even with same timestamp for atime. But as soon as a second client appears with an open file handle to the same file it fails to update ctime. That's the last switch I've included in the reproducer to control the multi-client behaviour.
You may have to run the reproducer (single and multi-client) in a loop to see the change in behaviour because at times ctime gets updated in multi-client scenario. But in single client use case ctime is always updated without any fail.
Looks like something related to cap then (or a combination w/ atime update when atime does not change).
I will have a look.
AC Updated by Anoop C S over 1 year ago
FYI: There's also #71622 that I have identified along similar lines but for mtime.
KS Updated by Konstantin Shalygin 8 months ago
- Backport changed from tentacle,squid,reef to tentacle,squid
MM Updated by Mahesh Mohan 6 months ago
- Assignee changed from Venky Shankar to Jos Collin
JC Updated by Jos Collin 6 months ago
- Status changed from Triaged to In Progress
JC Updated by Jos Collin 6 months ago
- Related to Bug #71622: libcephfs fails to update a futuristic timestamp for mtime post write operation added
JC Updated by Jos Collin 6 months ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 69595
JC Updated by Jos Collin 5 months ago
- Pull request ID deleted (
69595)
JC Updated by Jos Collin 5 months ago
- Pull request ID set to 69921
JC Updated by Jos Collin 5 months ago
- Related to deleted (Bug #71622: libcephfs fails to update a futuristic timestamp for mtime post write operation)
JC Updated by Jos Collin 5 months ago
VS Updated by Venky Shankar 5 months ago
- Target version changed from v21.0.0 to v22.0.0
UB Updated by Upkeep Bot 4 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to 41f11acc2c36e7cdc33f2d0613ec85b2a062bf48
- Fixed In set to v21.3.0-2446-g41f11acc2c
- Upkeep Timestamp set to 2026-08-20T13:29:19+00:00
JC Updated by Jos Collin 3 months ago
- Backport changed from tentacle,squid to umbrella,tentacle,squid
JC Updated by Jos Collin 3 months ago
- Copied to Backport #79755: umbrella: libcephfs fails to update ctime post an update to atime with same timestamp added
JC Updated by Jos Collin 3 months ago
- Copied to Backport #79757: tentacle: libcephfs fails to update ctime post an update to atime with same timestamp added
JC Updated by Jos Collin 3 months ago
- Copied to Backport #79758: squid: libcephfs fails to update ctime post an update to atime with same timestamp added
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Upkeep Timestamp changed from 2026-08-20T13:29:19+00:00 to 2026-08-27T18:01:09+00:00