Re: [PATCH] xfs: log proper length of btree block in scrub/repair

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

 



On Tue, Aug 27, 2019 at 02:17:36PM -0500, Eric Sandeen wrote:
> xfs_trans_log_buf() takes a final argument of the last byte to
> log in the buffer; b_length is in basic blocks, so this isn't
> the correct last byte.  Fix it.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
> 
> just found by inspection/pattern matching, not tested TBH...
> 
> diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
> index 4cfeec57fb05..7bcc755beb40 100644
> --- a/fs/xfs/scrub/repair.c
> +++ b/fs/xfs/scrub/repair.c
> @@ -351,7 +351,7 @@ xrep_init_btblock(
>  	xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
>  	xfs_btree_init_block(mp, bp, btnum, 0, 0, sc->sa.agno);
>  	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_BTREE_BUF);
> -	xfs_trans_log_buf(tp, bp, 0, bp->b_length);
> +	xfs_trans_log_buf(tp, bp, 0, BBTOB(bp->b_length) - 1);

Ok, while this is technically wrong, it would not have resulted in a
bug at all. That's because the length would have been rounded up
to a BLFCHUNK of 128 bytes, and that covers the entire btree block
header. Hence the part of the buffer that actually matters for
recovery was still logged correctly.

Still, should be fixed, so consider it:

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[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