summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-11-05 15:51:17 +0100
committerChristian Brauner <brauner@kernel.org>2026-11-05 15:52:42 +0100
commit66a52b662e5c09c7e784d2656e0b7ab14b396a8f (patch)
tree7a561da87f998abd7699b712ce1cb9fe954d3278 /include/linux/timerqueue.h
parent05441d697f7f9a927264f4058cbbc6a03dfcac9d (diff)
parent45eb9737058fa78a73f17a5da55c8cb482c6d5bb (diff)
Merge patch series "libfs: fix readdir of offset directories"
Christian Brauner <brauner@kernel.org> says: readdir on tmpfs walks d_children and only uses the offset tree to map the file position back to a dentry. d_children and offset order disagree after a rename over a name, an exchange or a wrap of the offset allocator. An unlink between two getdents64() calls then makes the walk skip entries or return the whole directory again. So walk the offset tree itself in descending offset order. v1 did that with a full tree descent and a reference for every entry and was quite a bit slower. Now the walk keeps one ma_state for the whole call and takes no references at all. That relies on all writers holding i_rwsem exclusive while readdir holds it shared, and the maple tree only allows that if i_rwsem is the lock of the tree. The first patch makes it so, and lockdep now checks the writers. The last patch stops an lseek() past the end from returning the whole directory again. 1M entries on tmpfs, getdents64() with a 32k buffer: 146ms before, about 230ms with v1, 114ms now. Four processes listing the directory at the same time: 470ms per listing before, 113ms now. Tested with Nickolai's reproducer, generic/736 and a seek-after-closedir test, on tmpfs and on tmpfs exported over NFSv3 and NFSv4.2, on KASAN and lockdep kernels. I also wrote a TLA+ model of the walk (cf. [1]). [1]: https://github.com/brauner/linux-formal/tree/main/kernel/libfs/offset-readdir * patches from https://patch.msgid.link/20261101-work-libfs-offset_readdir-v2-0-c621125b56d1@kernel.org: libfs: end offset readdir at positions past DIR_OFFSET_EOD libfs: walk offset directories in offset order libfs: make i_rwsem the lock of the offset tree Link: https://patch.msgid.link/20261101-work-libfs-offset_readdir-v2-0-c621125b56d1@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions