mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-04 20:31:15 -06:00
ntfs: skip free cluster decrement when rollback fails
When the rollback in __ntfs_cluster_free() fails, the recursive
call returns a negative errno and the subsequent
ntfs_dec_free_clusters(vol, delta) subtracts that negative value,
adding bogus clusters to the counter on an already-failing volume.
Skip the decrement when the rollback failed.
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:
+2
-1
@@ -1045,8 +1045,9 @@ err_out:
|
||||
"Failed to rollback (error %i). Leaving inconsistent metadata! Unmount and run chkdsk.",
|
||||
(int)delta);
|
||||
NVolSetErrors(vol);
|
||||
} else {
|
||||
ntfs_dec_free_clusters(vol, delta);
|
||||
}
|
||||
ntfs_dec_free_clusters(vol, delta);
|
||||
up_write(&vol->lcnbmp_lock);
|
||||
memalloc_nofs_restore(memalloc_flags);
|
||||
ntfs_error(vol->sb, "Aborting (error %i).", err);
|
||||
|
||||
Reference in New Issue
Block a user