Re: [PATCH 12/15] btrfs-progs: check: increase counter error in check_inode_recs()

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

 




On 2018年01月26日 16:35, Su Yue wrote:
> Counter @error decides return values of check_inode_recs().
> 
> Previously, @error won't be incremented even repair_inode_recs() failed.
> It causes 'btrfs check --repair' prints some error information but
> returns 0.
> 
> So, if root dir is missing and repair is disabled, @error should be
> incremented.
> And after repair_inode_recs(), increase @error if any errors in inodes
> and backrefs.
> 
> Signed-off-by: Su Yue <suy.fnst@xxxxxxxxxxxxxx>

Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>

Thanks,
Qu

> ---
>  cmds-check.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/cmds-check.c b/cmds-check.c
> index b23a4493b12b..a83f0a92f48b 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -4137,6 +4137,7 @@ static int check_inode_recs(struct btrfs_root *root,
>  			return -EAGAIN;
>  		}
>  
> +		error++;
>  		fprintf(stderr, "root %llu root dir %llu not found\n",
>  			(unsigned long long)root->root_key.objectid,
>  			(unsigned long long)root_dirid);
> @@ -4176,10 +4177,9 @@ static int check_inode_recs(struct btrfs_root *root,
>  				free_inode_rec(rec);
>  				continue;
>  			}
> -			ret = 0;
>  		}
>  
> -		if (!(repair && ret == 0))
> +		if (rec->errors)
>  			error++;
>  		print_inode_error(root, rec);
>  		list_for_each_entry(backref, &rec->backrefs, list) {
> @@ -4189,6 +4189,8 @@ static int check_inode_recs(struct btrfs_root *root,
>  				backref->errors |= REF_ERR_NO_DIR_INDEX;
>  			if (!backref->found_inode_ref)
>  				backref->errors |= REF_ERR_NO_INODE_REF;
> +			if (backref->errors)
> +				error++;
>  			fprintf(stderr, "\tunresolved ref dir %llu index %llu"
>  				" namelen %u name %s filetype %d errors %x",
>  				(unsigned long long)backref->dir,
> 

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