Darrick J. Wong ce99494c96 xfs: fix buffer corruption reporting when xfs_dir3_free_header_check fails
xfs_verifier_error is supposed to be called on a corrupt metadata buffer
from within a buffer verifier function, whereas xfs_buf_mark_corrupt
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_mark_corrupt 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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2020-03-12 07:58:12 -07:00
..
2019-09-27 15:10:34 -07:00
2020-02-23 09:43:50 -08:00
2019-09-19 09:42:37 -07:00
2020-02-17 21:08:37 -08:00
2019-11-11 09:21:59 -05:00
2020-02-11 16:52:08 -08:00
2019-09-19 09:42:37 -07:00
2020-02-05 05:28:20 +00:00
2020-02-07 17:50:21 -08:00
\n
2020-01-30 15:37:41 -08:00
2019-09-19 09:42:37 -07:00
2020-01-14 13:28:28 -08:00
2020-02-26 16:58:15 +09:00
2020-02-05 20:34:32 -08:00
2019-08-07 21:51:47 -04:00
2020-01-29 19:38:34 -08:00
2020-02-07 14:48:35 -05:00
2020-02-07 14:48:35 -05:00
2020-01-29 18:53:37 -08:00
2020-02-08 13:44:41 -08:00
2020-02-09 15:51:46 -08:00
2020-02-09 15:51:46 -08:00
2020-02-01 10:36:49 -08:00
2020-02-03 21:23:33 -05:00
2020-02-04 11:45:21 +00:00
2019-12-08 14:37:36 +01:00