linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH v2] xfs: only validate summary counts on primary superblock
Date: Thu, 2 Aug 2018 11:20:50 +0200	[thread overview]
Message-ID: <20180802092050.wc4qoscerrrek5k2@odin.usersys.redhat.com> (raw)
In-Reply-To: <20180802061331.GP30972@magnolia>

On Wed, Aug 01, 2018 at 11:13:31PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Skip the summary counter checks for secondary superblocks and inprogress
> primary superblocks because mkfs has always written those out with
> zeroed summary counters.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> v2: add the inprogress check
> ---

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

>  fs/xfs/libxfs/xfs_sb.c |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index ca1b3a7a9171..081f46e30556 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -148,6 +148,7 @@ xfs_validate_sb_read(
>  STATIC int
>  xfs_validate_sb_write(
>  	struct xfs_mount	*mp,
> +	struct xfs_buf		*bp,
>  	struct xfs_sb		*sbp)
>  {
>  	/*
> @@ -155,10 +156,15 @@ xfs_validate_sb_write(
>  	 * the superblock.  We skip this in the read validator because there
>  	 * could be newer superblocks in the log and if the values are garbage
>  	 * even after replay we'll recalculate them at the end of log mount.
> +	 *
> +	 * mkfs has traditionally written zeroed counters to inprogress and
> +	 * secondary superblocks, so allow this usage to continue because
> +	 * we never read counters from such superblocks.
>  	 */
> -	if (sbp->sb_fdblocks > sbp->sb_dblocks ||
> -	    !xfs_verify_icount(mp, sbp->sb_icount) ||
> -	    sbp->sb_ifree > sbp->sb_icount) {
> +	if (XFS_BUF_ADDR(bp) == XFS_SB_DADDR && !sbp->sb_inprogress &&
> +	    (sbp->sb_fdblocks > sbp->sb_dblocks ||
> +	     !xfs_verify_icount(mp, sbp->sb_icount) ||
> +	     sbp->sb_ifree > sbp->sb_icount)) {
>  		xfs_warn(mp, "SB summary counter sanity check failed");
>  		return -EFSCORRUPTED;
>  	}
> @@ -756,7 +762,7 @@ xfs_sb_write_verify(
>  	error = xfs_validate_sb_common(mp, bp, &sb);
>  	if (error)
>  		goto out_error;
> -	error = xfs_validate_sb_write(mp, &sb);
> +	error = xfs_validate_sb_write(mp, bp, &sb);
>  	if (error)
>  		goto out_error;
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Carlos

      reply	other threads:[~2018-08-02 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  6:13 [PATCH v2] xfs: only validate summary counts on primary superblock Darrick J. Wong
2018-08-02  9:20 ` Carlos Maiolino [this message]

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=20180802092050.wc4qoscerrrek5k2@odin.usersys.redhat.com \
    --to=cmaiolino@redhat.com \
    --cc=darrick.wong@oracle.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).