Project

General

Profile

Actions

Bug #71639

closed
AC JC

libcephfs fails to update ctime post an update to atime with same timestamp

Bug #71639: libcephfs fails to update ctime post an update to atime with same timestamp

Added by Anoop C S over 1 year ago. Updated 3 months ago.

Status:
Backporting
Priority:
Normal
Assignee:
Category:
Correctness/Safety
Target version:
Due date:
% Done:

0%

Source:
Community (user)
Backport:
umbrella,tentacle,squid
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Client, Samba VFS, libcephfs
Labels (FS):
Samba/CIFS
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-2446-g41f11acc2c
Released In:
Upkeep Timestamp:
2026-08-27T18:01:09+00:00

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

libcephfs_fh_ctime.c (5.37 KB) libcephfs_fh_ctime.c Anoop C S, 06/11/2025 02:01 PM

Related issues 3 (3 open — 0 closed)

Copied to CephFS - Backport #79755: umbrella: libcephfs fails to update ctime post an update to atime with same timestampFix Under ReviewJos Collin

Actions
Copied to CephFS - Backport #79757: tentacle: libcephfs fails to update ctime post an update to atime with same timestampFix Under ReviewJos Collin

Actions
Copied to CephFS - Backport #79758: squid: libcephfs fails to update ctime post an update to atime with same timestampFix Under ReviewJos Collin

Actions

AC Updated by Anoop C S over 1 year ago Actions #1

  • 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 Actions #2

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 Actions #3

  • 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 Actions #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.

VS Updated by Venky Shankar over 1 year ago 1Actions #5

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 Actions #6

FYI: There's also #71622 that I have identified along similar lines but for mtime.

KS Updated by Konstantin Shalygin 8 months ago Actions #7

  • Backport changed from tentacle,squid,reef to tentacle,squid

MM Updated by Mahesh Mohan 6 months ago Actions #8

  • Assignee changed from Venky Shankar to Jos Collin

JC Updated by Jos Collin 6 months ago Actions #9

  • Status changed from Triaged to In Progress

JC Updated by Jos Collin 6 months ago Actions #10

  • 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 Actions #11

  • Status changed from In Progress to Fix Under Review
  • Pull request ID set to 69595

JC Updated by Jos Collin 5 months ago Actions #12

  • Pull request ID deleted (69595)

JC Updated by Jos Collin 5 months ago Actions #13

  • Pull request ID set to 69921

JC Updated by Jos Collin 5 months ago Actions #14

  • 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 Actions #15

Anoop C S wrote in #note-6:

FYI: There's also #71622 that I have identified along similar lines but for mtime.

The issue with mtime not updating on write op is not the same. It's a completely different issue, needs investigation separately and needs a separate fix.

VS Updated by Venky Shankar 5 months ago Actions #16

  • Target version changed from v21.0.0 to v22.0.0

UB Updated by Upkeep Bot 4 months ago Actions #17

  • 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 Actions #18

  • Backport changed from tentacle,squid to umbrella,tentacle,squid

JC Updated by Jos Collin 3 months ago Actions #19

  • 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 Actions #20

  • 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 Actions #21

  • 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 Actions #22

  • 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
Actions

Also available in: PDF Atom