Re: [PATCH v1 9/9] ntfs: skip free cluster decrement when rollback fails

Hyunchul Lee <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,dev.linux.lists.ntfs
Message-ID <CANFS6bZqkFhDbM9Ac-pWx8-K-DxYXYcL+rfz8afJq78KdQ1xNA@mail.gmail.com>
2026년 8월 21일 (금) 오후 2:33, Baolin Liu <[email protected]>님이 작성:
>
> From: Baolin Liu <[email protected]>
>
> 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: 11ccc9107dc4 ("ntfs: update runlist handling and cluster allocator")
> Signed-off-by: Baolin Liu <[email protected]>

Looks good to me.

Reviewed-by: Hyunchul Lee <[email protected]>

> ---
>  fs/ntfs/lcnalloc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ntfs/lcnalloc.c b/fs/ntfs/lcnalloc.c
> index 795f71d26895..0d6cd08ee2e7 100644
> --- a/fs/ntfs/lcnalloc.c
> +++ b/fs/ntfs/lcnalloc.c
> @@ -1045,8 +1045,9 @@ s64 __ntfs_cluster_free(struct ntfs_inode *ni, const s64 start_vcn, s64 count,
>                         "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);
> --
> 2.51.0
>
>


-- 
Thanks,
Hyunchul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.