Re: [PATCH 2/4] repair: don't double check dir2 sf parent in phase 4

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

 



On Wed, Jul 15, 2020 at 10:08:34AM -0400, Brian Foster wrote:
> The shortform parent ino verification code runs once in phase 3
> (ino_discovery == true) and once in phase 4 (ino_discovery ==
> false). This is unnecessary and leads to duplicate error messages if
> repair replaces an invalid parent value with zero because zero is
> still an invalid value. Skip the check in phase 4.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> ---
>  repair/dir2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/repair/dir2.c b/repair/dir2.c
> index cbbce601..caf6963d 100644
> --- a/repair/dir2.c
> +++ b/repair/dir2.c
> @@ -480,6 +480,9 @@ _("corrected entry offsets in directory %" PRIu64 "\n"),
>  	 * check parent (..) entry
>  	 */
>  	*parent = libxfs_dir2_sf_get_parent_ino(sfp);
> +	if (!ino_discovery)
> +		return 0;

I feel like this ought to have a comment explaining why we skip only the
parent check in phase 4:

/*
 * If this function is called during inode discovery (phase 3), it will
 * set a bad sf dir parent pointer to the root directory.  This fixes
 * the directory enough to pass the inode fork verifier in phase 6 when
 * we try to reset the parent pointer to the correct value.  There is no
 * need to re-check the parent pointer during phase 4.
 */

With that added,
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> +
>  
>  	/*
>  	 * if parent entry is bogus, null it out.  we'll fix it later .
> -- 
> 2.21.3
> 



[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