Re: [PATCH] Btrfs: don't leak reloc root nodes on error

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

 



On Fri, Sep 02, 2016 at 03:25:43PM -0400, Josef Bacik wrote:
> We don't track the reloc roots in any sort of normal way, so the only way the
> root/commit_root nodes get free'd is if the relocation finishes successfully and
> the reloc root is deleted.  Fix this by free'ing them in free_reloc_roots.
> Thanks,

Looks good.

> 
> Signed-off-by: Josef Bacik <jbacik@xxxxxx>
> ---
>  fs/btrfs/relocation.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 7fc6ea7..62dfc2c 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -2349,6 +2349,10 @@ void free_reloc_roots(struct list_head *list)
>  	while (!list_empty(list)) {
>  		reloc_root = list_entry(list->next, struct btrfs_root,
>  					root_list);
> +		free_extent_buffer(reloc_root->node);
> +		free_extent_buffer(reloc_root->commit_root);
> +		reloc_root->node = NULL;
> +		reloc_root->commit_root = NULL;

What about reloc_root itself?

Thanks,

-liubo

>  		__del_reloc_root(reloc_root);
>  	}
>  }
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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