Re: [PATCH] Btrfs-progs: fsck: fix wrong return value in check_block()

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

 



On Mon, Feb 24, 2014 at 5:55 AM, Wang Shilong
<wangsl.fnst@xxxxxxxxxxxxxx> wrote:
> We found btrfsck will output backrefs mismatch while the filesystem
> is defenitely ok.
>
> The problem is that check_block() don't return right value,which
> makes btrfsck won't walk all tree blocks thus we don't get a consistent
> filesystem, we will fail to check extent refs etc.
>
> Reported-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
> Signed-off-by: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
> ---
>  cmds-check.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmds-check.c b/cmds-check.c
> index a2afae6..253569f 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -2477,7 +2477,7 @@ static int check_block(struct btrfs_trans_handle *trans,
>         struct cache_extent *cache;
>         struct btrfs_key key;
>         enum btrfs_tree_block_status status;
> -       int ret = 1;
> +       int ret = 0;
>         int level;
>
>         cache = lookup_cache_extent(extent_cache, buf->start, buf->len);
> --

I tried this fix on a broken btrfs volume I've been trying to repair,
and it seemed to put me in an infinite loop.

I agree that something seems wrong with the way the caller of
check_block uses the return value, and I also noticed that it seemed
to exit before walking all the tree blocks.

But I think the problem is more subtle than flipping the default ret
value from 1 to 0.
--
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