Re: [PATCH 1/3] btrfs-progs: rescue: properly close the fs for clear-ino-cache

Anand Jain
2024-02-02T08:48:56Z

On 2/2/24 06:29, Qu Wenruo wrote:
> [BUG]
> In cmd_rescue_clear_ino_cache(), we opened the fs, but without
> closing it using close_ctree().
>
> [CAUSE]
> All my bad, I forgot it, as the original code is inside btrfs check, and
> had a "goto out_close;" to properly close the fs.

Nit:
Forgot to add commit id that missed this?

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thx. Anand

>
> [FIX]
> Manually call close_ctree() on the fs_info->tree_root.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> cmds/rescue.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/cmds/rescue.c b/cmds/rescue.c
> index 621e243b2073..6d7d526df145 100644
> --- a/cmds/rescue.c
> +++ b/cmds/rescue.c
> @@ -451,6 +451,7 @@ static int cmd_rescue_clear_ino_cache(const struct cmd_struct *cmd,
> } else {
> pr_verbose(LOG_DEFAULT, "Successfully cleared ino cache");
> }
> + close_ctree(fs_info->tree_root);
> out:
> return !!ret;
> }