]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix missing error handling when searching for inode refs during log replay
authorFilipe Manana <fdmanana@suse.com>
Wed, 18 Jun 2025 15:57:07 +0000 (16:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:44 +0000 (15:57 +0200)
commita1950bb9edfae52d0176a07a1c9fe4b4da79be26
tree87082d50469f648497c8d71e2d4c98abbfacaf98
parent9f0771b8cc4a02cf7df4f52b5c284ebff5950656
btrfs: fix missing error handling when searching for inode refs during log replay

[ Upstream commit 6561a40ceced9082f50c374a22d5966cf9fc5f5c ]

During log replay, at __add_inode_ref(), when we are searching for inode
ref keys we totally ignore if btrfs_search_slot() returns an error. This
may make a log replay succeed when there was an actual error and leave
some metadata inconsistency in a subvolume tree. Fix this by checking if
an error was returned from btrfs_search_slot() and if so, return it to
the caller.

Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-log.c