Re: [PATCH 6/6] xfs_scrub: fix weirdness in directory name check code

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

 



On 09 Feb 2021 at 09:41, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@xxxxxxxxxx>
>
> Remove the redundant second check of fd and ISDIR in check_inode_names,
> and rework the comment to describe why we can't run phase 5 if we found
> other corruptions in the filesystem.
>

Looks good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@xxxxxxxxx>

> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> ---
>  scrub/phase5.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
>
> diff --git a/scrub/phase5.c b/scrub/phase5.c
> index ee1e5d6c..1ef234bf 100644
> --- a/scrub/phase5.c
> +++ b/scrub/phase5.c
> @@ -278,7 +278,12 @@ check_inode_names(
>  			goto out;
>  	}
>  
> -	/* Open the dir, let the kernel try to reconnect it to the root. */
> +	/*
> +	 * Warn about naming problems in the directory entries.  Opening the
> +	 * dir by handle means the kernel will try to reconnect it to the root.
> +	 * If the reconnection fails due to corruption in the parents we get
> +	 * ESTALE, which is why we skip phase 5 if we found corruption.
> +	 */
>  	if (S_ISDIR(bstat->bs_mode)) {
>  		fd = scrub_open_handle(handle);
>  		if (fd < 0) {
> @@ -288,10 +293,7 @@ check_inode_names(
>  			str_errno(ctx, descr_render(&dsc));
>  			goto out;
>  		}
> -	}
>  
> -	/* Warn about naming problems in the directory entries. */
> -	if (fd >= 0 && S_ISDIR(bstat->bs_mode)) {
>  		error = check_dirent_names(ctx, &dsc, &fd, bstat);
>  		if (error)
>  			goto out;


-- 
chandan



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux