diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-09-12 15:04:29 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-28 20:19:35 +0300 |
commit | d5e09e385e8abfdbbd9af3e2c83e4e8ca854f2ef (patch) | |
tree | 5b9f81d78acc070a42f8dd9eca18a3f383927962 /lib | |
parent | 304a2c4aad0fff887ce493e4197bf9cbaf394479 (diff) | |
download | linux-d5e09e385e8abfdbbd9af3e2c83e4e8ca854f2ef.tar.xz |
btrfs: abort transaction on generation mismatch when marking eb as dirty
[ Upstream commit 50564b651d01c19ce732819c5b3c3fd60707188e ]
When marking an extent buffer as dirty, at btrfs_mark_buffer_dirty(),
we check if its generation matches the running transaction and if not we
just print a warning. Such mismatch is an indicator that something really
went wrong and only printing a warning message (and stack trace) is not
enough to prevent a corruption. Allowing a transaction to commit with such
an extent buffer will trigger an error if we ever try to read it from disk
due to a generation mismatch with its parent generation.
So abort the current transaction with -EUCLEAN if we notice a generation
mismatch. For this we need to pass a transaction handle to
btrfs_mark_buffer_dirty() which is always available except in test code,
in which case we can pass NULL since it operates on dummy extent buffers
and all test roots have a single node/leaf (root node at level 0).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions