]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs/ntfs3: allow readdir() to finish after directory mutations without rewinddir()
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 9 Dec 2025 09:08:32 +0000 (12:08 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 19 Dec 2025 18:04:01 +0000 (19:04 +0100)
commitdffc7f2f177b7f1ca52067dc23d0304d7a25d45c
tree797d4b0c6d1d21374b8d0c878cf5d6587e36ee6b
parent989e29450efaf4983c66b7a628f2ffc03b6d02e8
fs/ntfs3: allow readdir() to finish after directory mutations without rewinddir()

This patch introduces a per-directory version counter that increments on
each directory modification (indx_insert_entry() / indx_delete_entry()).
ntfs_readdir() uses this version to detect whether the directory has
changed since enumeration began. If readdir() reaches end-of-directory
but the version has changed, the walk restarts from the beginning of the
index tree instead of returning prematurely. This provides rmdir-like
behavior for tools that remove entries as they enumerate them.

Prior to this change, bonnie++ directory operations could fail due to
premature termination of readdir() during concurrent index updates.
With this patch applied, bonnie++ completes successfully with no errors.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/dir.c
fs/ntfs3/index.c
fs/ntfs3/ntfs_fs.h