libfs: fix multigrain timestamps of tmpfs directories
Get series with b4
b4 am [email protected] change-id 20261125-work-libfs-mgtime-513953909f3dVersions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | libfs: don't copy the child's ctime to the parent directoryfs/ | +4 | 2 replies | |
| 2/2 | selftests/filesystems: test multigrain timestamps of tmpfs directoriestools/ tools/ tools/ | +246 | 0 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Jeff Layton | Jan Kara |
|---|---|---|
| 1/2 | R-b | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] libfs: fix multigrain timestamps of tmpfs directories
simple_link() and __simple_unlink() copy the child's new ctime into the parent directory. That doesn't work with multigrain timestamps. The child's ctime is only fine-grained if the child itself was queried and copying it clears the I_CTIME_QUERIED flag of the directory.
tmpfs is the only multigrain filesystem that uses these helpers. So since v6.13 a tmpfs directory whose timestamps were queried can come out of link(), unlink(), rmdir() or a rename over an existing entry with the same ctime and mtime as before. If the renamed entry comes from another directory size and link count stay the same as well and userspace has no way to tell that the directory changed at all. In a VM that happened in 1738 of 2000 tries.
Give the directory its own inode_set_ctime_current() call like the other multigrain filesystems do and add a selftest that checks the timestamps of the parent directory after each directory operation.
---
Christian Brauner (2):
libfs: don't copy the child's ctime to the parent directory selftests/filesystems: test multigrain timestamps of tmpfs directories
fs/libfs.c | 8 +- tools/testing/selftests/filesystems/.gitignore | 1 + tools/testing/selftests/filesystems/Makefile | 1 + tools/testing/selftests/filesystems/mgtime_test.c | 244 ++++++++++++++++++++++ 4 files changed, 250 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261125-work-libfs-mgtime-513953909f3d