Bug #39523
small write in ab mode does not change mtime
0%
Description
When we make a small write to a file opened with mode 'ab', the mtime/ctime of the file does not change. (This applies to the kernel client only -- ceph-fuse updates mtime correctly).
# uname -a Linux cephfs-test-3da8667dd5.cern.ch 5.0.10-1.el7.elrepo.x86_64 #1 SMP Sat Apr 27 08:40:16 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux # cat ab.py #!/usr/bin/env python f = open('a','ab') f.write('a1') f.close() # touch a # ls -l a -rw-r--r-- 1 root root 0 Apr 29 16:05 a # stat a File: ‘a’ Size: 0 Blocks: 0 IO Block: 4194304 regular empty file Device: 0h/0d Inode: 5497575933971 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:cephfs_t:s0 Access: 2019-04-29 16:05:36.240254000 +0200 Modify: 2019-04-29 16:05:36.240254000 +0200 Change: 2019-04-29 16:05:36.240254000 +0200 Birth: - # ./ab.py # first time appending ... it updates mtime. # stat a File: ‘a’ Size: 2 Blocks: 1 IO Block: 4194304 regular file Device: 0h/0d Inode: 5497575933971 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:cephfs_t:s0 Access: 2019-04-29 16:05:36.240254000 +0200 Modify: 2019-04-29 16:05:54.158247000 +0200 Change: 2019-04-29 16:05:54.158247000 +0200 Birth: - # ./ab.py # 2nd time appending... mtime not updated # stat a File: ‘a’ Size: 4 Blocks: 1 IO Block: 4194304 regular file Device: 0h/0d Inode: 5497575933971 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:cephfs_t:s0 Access: 2019-04-29 16:05:36.240254000 +0200 Modify: 2019-04-29 16:05:54.158247000 +0200 Change: 2019-04-29 16:05:54.158247000 +0200 Birth: -
It doesn't appear to be a caching issue -- if we umount / mount again the old incorrect mtime is still shown.
If we do a large write (e.g. 2MB) then the mtime is updated correctly.
History
#1 Updated by Zheng Yan almost 5 years ago
can't reproduce this issue on 5.0.16 kernel + ceph v12.2.12
#2 Updated by Jeff Layton over 4 years ago
- Status changed from New to Can't reproduce
Works for me too with current kernels. I took a quick look and didn't see anything that would account for fixing this between v5.0.10 and v5.0.16 though. Maybe this is a MDS bug of some sort?
In any case, you may want to update to something newer than v5.0.10 and test again. Please reopen if you're still able to reproduce.