mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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>
This commit is contained in:
@@ -191,6 +191,7 @@ struct ntfs_index {
|
||||
struct runs_tree alloc_run;
|
||||
/* read/write access to 'bitmap_run'/'alloc_run' while ntfs_readdir */
|
||||
struct rw_semaphore run_lock;
|
||||
size_t version; /* increment each change */
|
||||
|
||||
/*TODO: Remove 'cmp'. */
|
||||
NTFS_CMP_FUNC cmp;
|
||||
|
||||
Reference in New Issue
Block a user