mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
ntfs: only count successfully cleared runs when freeing clusters
ntfs_cluster_free_from_rl_nolock() adds a run's length to nr_freed
whenever the error bookkeeping condition is false, which includes
cases where ntfs_bitmap_clear_run() actually failed - e.g. a second
run failing with the same errno as an earlier one, or any failure
after a non-ENOMEM error was already recorded. Since a failed
ntfs_bitmap_clear_run() rolls back its partial modifications, no
bits were cleared for that run, yet its length still inflates
vol->free_clusters, corrupting statfs output and the allocator's
free space gate.
Only count runs whose bitmap clear succeeded.
Fixes: 11ccc9107d ("ntfs: update runlist handling and cluster allocator")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
cf06dcd572
commit
be9e89ccb8
|
|
@ -53,10 +53,10 @@ int ntfs_cluster_free_from_rl_nolock(struct ntfs_volume *vol,
|
|||
if (rl->lcn < 0)
|
||||
continue;
|
||||
err = ntfs_bitmap_clear_run(lcnbmp_vi, rl->lcn, rl->length);
|
||||
if (unlikely(err && (!ret || ret == -ENOMEM) && ret != err))
|
||||
ret = err;
|
||||
else
|
||||
if (likely(!err))
|
||||
nr_freed += rl->length;
|
||||
else if (!ret || ret == -ENOMEM)
|
||||
ret = err;
|
||||
}
|
||||
ntfs_inc_free_clusters(vol, nr_freed);
|
||||
ntfs_debug("Done.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user