Skip to content

Commit d8672d6

Browse files
committed
ceph: fix update of ctime from MDS
The client can have a newer ctime than the MDS due to AUTH_EXCL and XATTR_EXCL caps as well; update the check in ceph_fill_file_time appropriately. This fixes cases where ctime/mtime goes backward under the right sequence of local updates (e.g. chmod) and mds replies (e.g. subsequent stat that goes to the MDS). Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 8bd59e0 commit d8672d6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎fs/ceph/inode.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
471471

472472
if (issued & (CEPH_CAP_FILE_EXCL|
473473
CEPH_CAP_FILE_WR|
474-
CEPH_CAP_FILE_BUFFER)) {
474+
CEPH_CAP_FILE_BUFFER|
475+
CEPH_CAP_AUTH_EXCL|
476+
CEPH_CAP_XATTR_EXCL)) {
475477
if (timespec_compare(ctime, &inode->i_ctime) > 0) {
476478
dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n",
477479
inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
@@ -511,7 +513,7 @@ void ceph_fill_file_time(struct inode *inode, int issued,
511513
warn = 1;
512514
}
513515
} else {
514-
/* we have no write caps; whatever the MDS says is true */
516+
/* we have no write|excl caps; whatever the MDS says is true */
515517
if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) {
516518
inode->i_ctime = *ctime;
517519
inode->i_mtime = *mtime;

0 commit comments

Comments
 (0)