mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
xfs: ensure buffer types are set correctly
commit 0d612fb570 upstream.
Jan Kara reported that log recovery was finding buffers with invalid
types in them. This should not happen, and indicates a bug in the
logging of buffers. To catch this, add asserts to the buffer
formatting code to ensure that the buffer type is in range when the
transaction is committed.
We don't set a type on buffers being marked stale - they are not
going to get replayed, the format item exists only for recovery to
be able to prevent replay of the buffer, so the type does not
matter. Hence that needs special casing here.
Reported-by: Jan Kara <jack@suse.cz>
Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8a3f71b3e1
commit
aa7583d3c1
@@ -319,6 +319,10 @@ xfs_buf_item_format(
|
|||||||
ASSERT(atomic_read(&bip->bli_refcount) > 0);
|
ASSERT(atomic_read(&bip->bli_refcount) > 0);
|
||||||
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
|
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
|
||||||
(bip->bli_flags & XFS_BLI_STALE));
|
(bip->bli_flags & XFS_BLI_STALE));
|
||||||
|
ASSERT((bip->bli_flags & XFS_BLI_STALE) ||
|
||||||
|
(xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF
|
||||||
|
&& xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it is an inode buffer, transfer the in-memory state to the
|
* If it is an inode buffer, transfer the in-memory state to the
|
||||||
|
|||||||
Reference in New Issue
Block a user