Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()

Qu Wenruo
2022-05-14T22:57:50Z

On 2022/5/14 20:01, Christophe JAILLET wrote:
> If alloc_dummy_extent_buffer() we should return an error code, not 0 that
> would mean success.
>
> Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Qu Wenruo <wqu@suse.com>

All my fault, thanks for catching it.
Qu

> ---
> fs/btrfs/volumes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index b2d5a54ea172..9c20049d1fec 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -7359,7 +7359,7 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
> */
> sb = alloc_dummy_extent_buffer(fs_info, BTRFS_SUPER_INFO_OFFSET);
> if (!sb)
> - return PTR_ERR(sb);
> + return -ENOMEM;
> set_extent_buffer_uptodate(sb);
>
> write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);