Re: [PATCH 1/1] xfs_repair: double-check with shortform attr verifiers

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

 



On Tue, Mar 12, 2024 at 07:11:17PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@xxxxxxxxxx>
> 
> Call the shortform attr structure verifier as the last thing we do in
> process_shortform_attr to make sure that we don't leave any latent
> errors for the kernel to stumble over.
> 
> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>

Reviewed-by: Bill O'Donnell <bodonnel@xxxxxxxxxx>

> ---
>  repair/attr_repair.c |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> 
> diff --git a/repair/attr_repair.c b/repair/attr_repair.c
> index 01e4afb90d5c..f117f9aef9ce 100644
> --- a/repair/attr_repair.c
> +++ b/repair/attr_repair.c
> @@ -212,6 +212,7 @@ process_shortform_attr(
>  {
>  	struct xfs_attr_sf_hdr		*hdr = XFS_DFORK_APTR(dip);
>  	struct xfs_attr_sf_entry	*currententry, *nextentry, *tempentry;
> +	xfs_failaddr_t			fa;
>  	int				i, junkit;
>  	int				currentsize, remainingspace;
>  
> @@ -373,6 +374,22 @@ process_shortform_attr(
>  		}
>  	}
>  
> +	fa = libxfs_attr_shortform_verify(hdr, be16_to_cpu(hdr->totsize));
> +	if (fa) {
> +		if (no_modify) {
> +			do_warn(
> +	_("inode %" PRIu64 " shortform attr verifier failure, would have cleared attrs\n"),
> +				ino);
> +		} else {
> +			do_warn(
> +	_("inode %" PRIu64 " shortform attr verifier failure, cleared attrs\n"),
> +				ino);
> +			hdr->count = 0;
> +			hdr->totsize = cpu_to_be16(sizeof(struct xfs_attr_sf_hdr));
> +			*repair = 1;
> +		}
> +	}
> +
>  	return(*repair);
>  }
>  
> 
> 





[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