linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 01/16] xfs: sb verifier doesn't handle uncached sb buffer
Date: Tue, 10 Aug 2021 17:34:58 -0700	[thread overview]
Message-ID: <20210811003458.GV3601443@magnolia> (raw)
In-Reply-To: <20210810052451.41578-2-david@fromorbit.com>

On Tue, Aug 10, 2021 at 03:24:36PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> The verifier checks explicitly for bp->b_bn == XFS_SB_DADDR to match
> the primary superblock buffer, but the primary superblock is an
> uncached buffer and so bp->b_bn is always -1ULL. Hence this never
> matches and the CRC error reporting is wholly dependent on the
> mount superblock already being populated so CRC feature checks pass
> and allow CRC errors to be reported.
> 
> Fix this so that the primary superblock CRC error reporting is not
> dependent on already having read the superblock into memory.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Not sure why this isn't in the series with xfs_buf_daddr and the other
cleanups, but the changes look correct to me.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_sb.c | 2 +-
>  fs/xfs/xfs_buf.h       | 7 ++++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index 04f5386446db..4a4586bd2ba2 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -636,7 +636,7 @@ xfs_sb_read_verify(
>  
>  		if (!xfs_buf_verify_cksum(bp, XFS_SB_CRC_OFF)) {
>  			/* Only fail bad secondaries on a known V5 filesystem */
> -			if (bp->b_bn == XFS_SB_DADDR ||
> +			if (bp->b_maps[0].bm_bn == XFS_SB_DADDR ||
>  			    xfs_sb_version_hascrc(&mp->m_sb)) {
>  				error = -EFSBADCRC;
>  				goto out_error;
> diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
> index cfbe37d73293..37c9004f11de 100644
> --- a/fs/xfs/xfs_buf.h
> +++ b/fs/xfs/xfs_buf.h
> @@ -133,7 +133,12 @@ struct xfs_buf {
>  	 * fast-path on locking.
>  	 */
>  	struct rhash_head	b_rhash_head;	/* pag buffer hash node */
> -	xfs_daddr_t		b_bn;		/* block number of buffer */
> +
> +	/*
> +	 * b_bn is the cache index. Do not use directly, use b_maps[0].bm_bn
> +	 * for the buffer disk address instead.
> +	 */
> +	xfs_daddr_t		b_bn;
>  	int			b_length;	/* size of buffer in BBs */
>  	atomic_t		b_hold;		/* reference count */
>  	atomic_t		b_lru_ref;	/* lru reclaim ref count */
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-08-11  0:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  5:24 [PATCH 00/16 v2] xfs: rework feature flags Dave Chinner
2021-08-10  5:24 ` [PATCH 01/16] xfs: sb verifier doesn't handle uncached sb buffer Dave Chinner
2021-08-11  0:34   ` Darrick J. Wong [this message]
2021-08-12  7:52   ` Christoph Hellwig
2021-08-10  5:24 ` [PATCH 02/16] xfs: rename xfs_has_attr() Dave Chinner
2021-08-12  8:03   ` Christoph Hellwig
2021-08-18  0:56     ` Dave Chinner
2021-08-18  2:56       ` Darrick J. Wong
2021-08-10  5:24 ` [PATCH 03/16] xfs: rework attr2 feature and mount options Dave Chinner
2021-08-11 23:04   ` Darrick J. Wong
2021-08-18  1:18     ` Dave Chinner
2021-08-12  0:27   ` Darrick J. Wong
2021-08-18  1:25     ` Dave Chinner
2021-08-10  5:24 ` [PATCH 04/16] xfs: reflect sb features in xfs_mount Dave Chinner
2021-08-10  5:24 ` [PATCH 05/16] xfs: replace xfs_sb_version checks with feature flag checks Dave Chinner
2021-08-11 22:13   ` Darrick J. Wong
2021-08-18  1:33     ` Dave Chinner
2021-08-10  5:24 ` [PATCH 06/16] xfs: consolidate mount option features in m_features Dave Chinner
2021-08-12  8:07   ` Christoph Hellwig
2021-08-10  5:24 ` [PATCH 07/16] xfs: convert mount flags to features Dave Chinner
2021-08-11  0:38   ` Darrick J. Wong
2021-08-11 23:28     ` Darrick J. Wong
2021-08-18  2:25       ` Dave Chinner
2021-08-10  5:24 ` [PATCH 08/16] xfs: convert remaining mount flags to state flags Dave Chinner
2021-08-10  5:24 ` [PATCH 09/16] xfs: replace XFS_FORCED_SHUTDOWN with xfs_is_shutdown Dave Chinner
2021-08-10  5:24 ` [PATCH 10/16] xfs: convert xfs_fs_geometry to use mount feature checks Dave Chinner
2021-08-11  0:39   ` Darrick J. Wong
2021-08-10  5:24 ` [PATCH 11/16] xfs: open code sb verifier " Dave Chinner
2021-08-11  0:48   ` Darrick J. Wong
2021-08-10  5:24 ` [PATCH 12/16] xfs: convert scrub to use mount-based " Dave Chinner
2021-08-10  5:24 ` [PATCH 13/16] xfs: convert xfs_sb_version_has checks to use mount features Dave Chinner
2021-08-10  5:24 ` [PATCH 14/16] xfs: remove unused xfs_sb_version_has wrappers Dave Chinner
2021-08-10  5:24 ` [PATCH 15/16] xfs: introduce xfs_sb_is_v5 helper Dave Chinner
2021-08-10  5:24 ` [PATCH 16/16] xfs: kill xfs_sb_version_has_v3inode() Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2021-08-18 23:59 [PATCH 00/16 v3] xfs: rework feature flags Dave Chinner
2021-08-18 23:59 ` [PATCH 01/16] xfs: sb verifier doesn't handle uncached sb buffer Dave Chinner
2021-07-14  4:18 [PATCH 00/16] xfs: rework feature flags Dave Chinner
2021-07-14  4:18 ` [PATCH 01/16] xfs: sb verifier doesn't handle uncached sb buffer Dave Chinner
2021-07-14  6:43   ` Christoph Hellwig
2021-07-14  9:37     ` Dave Chinner
2021-07-14 22:44   ` Darrick J. Wong
2021-07-14 23:00     ` Dave Chinner
2021-07-14 23:03       ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811003458.GV3601443@magnolia \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).