Re: [PATCH 3/7] btrfs: splice rc->reloc_roots onto reloc roots in recover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2020/3/3 上午2:47, Josef Bacik wrote:
> If we have an error while processing the reloc roots we could leak roots
> that were added to rc->reloc_roots before we hit the error.  Handle this
> by splicing rc->reloc_roots onto our local reloc_roots list so they are
> properly cleaned up.
> 
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>

Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>

Thanks,
Qu

> ---
>  fs/btrfs/relocation.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 173fc7628235..f42589cb351c 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -4710,6 +4710,9 @@ int btrfs_recover_relocation(struct btrfs_root *root)
>  	if (ret < 0 && !err)
>  		err = ret;
>  out_free:
> +	mutex_lock(&fs_info->reloc_mutex);
> +	list_splice_init(&rc->reloc_roots, &reloc_roots);
> +	mutex_unlock(&fs_info->reloc_mutex);
>  	kfree(rc);
>  out:
>  	if (!list_empty(&reloc_roots))
> 

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux