All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/7] xfs: fix buffer corruption reporting when xfs_dir3_free_header_check fails
Date: Tue, 10 Mar 2020 17:47:33 -0700	[thread overview]
Message-ID: <158388765361.939165.18143580183240823438.stgit@magnolia> (raw)
In-Reply-To: <158388763282.939165.6485358230553665775.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

xfs_verifier_error is supposed to be called on a corrupt metadata buffer
from within a buffer verifier function, whereas xfs_buf_corruption_error
is the function to be called when a piece of code has read a buffer and
catches something that a read verifier cannot.  The first function sets
b_error anticipating that the low level buffer handling code will see
the nonzero b_error and clear XBF_DONE on the buffer, whereas the second
function does not.

Since xfs_dir3_free_header_check examines fields in the dir free block
header that require more context than can be provided to read verifiers,
we must call xfs_buf_corruption_error when it finds a problem.

Switching the calls has a secondary effect that we no longer corrupt the
buffer state by setting b_error and leaving XBF_DONE set.  When /that/
happens, we'll trip over various state assertions (most commonly the
b_error check in xfs_buf_reverify) on a subsequent attempt to read the
buffer.

Fixes: bc1a09b8e334bf5f ("xfs: refactor verifier callers to print address of failing check")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_dir2_node.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index dbd1e901da92..af4f22dc3891 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -226,7 +226,7 @@ __xfs_dir3_free_read(
 	/* Check things that we can't do in the verifier. */
 	fa = xfs_dir3_free_header_check(dp, fbno, *bpp);
 	if (fa) {
-		xfs_verifier_error(*bpp, -EFSCORRUPTED, fa);
+		__xfs_buf_mark_corrupt(*bpp, fa);
 		xfs_trans_brelse(tp, *bpp);
 		return -EFSCORRUPTED;
 	}


  parent reply	other threads:[~2020-03-11  0:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  0:47 [PATCH v2 0/7] xfs: fix errors in various verifiers Darrick J. Wong
2020-03-11  0:47 ` [PATCH 1/7] xfs: add a function to deal with corrupt buffers post-verifiers Darrick J. Wong
2020-03-11  5:35   ` Dave Chinner
2020-03-11 16:42     ` Darrick J. Wong
2020-03-11 18:25   ` [PATCH v2 " Darrick J. Wong
2020-03-12  4:37     ` Dave Chinner
2020-03-12  4:55       ` Darrick J. Wong
2020-03-11  0:47 ` [PATCH 2/7] xfs: xfs_buf_corruption_error should take __this_address Darrick J. Wong
2020-03-11  5:36   ` Dave Chinner
2020-03-11  0:47 ` Darrick J. Wong [this message]
2020-03-11  5:39   ` [PATCH 3/7] xfs: fix buffer corruption reporting when xfs_dir3_free_header_check fails Dave Chinner
2020-03-11  0:47 ` [PATCH 4/7] xfs: don't ever return a stale pointer from __xfs_dir3_free_read Darrick J. Wong
2020-03-11  5:47   ` Dave Chinner
2020-03-11  0:47 ` [PATCH 5/7] xfs: check owner of dir3 free blocks Darrick J. Wong
2020-03-11  5:47   ` Dave Chinner
2020-03-11  0:47 ` [PATCH 6/7] xfs: check owner of dir3 data blocks Darrick J. Wong
2020-03-11  5:51   ` Dave Chinner
2020-03-11  0:47 ` [PATCH 7/7] xfs: check owner of dir3 blocks Darrick J. Wong
2020-03-11  5:52   ` Dave Chinner

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=158388765361.939165.18143580183240823438.stgit@magnolia \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.