]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: deal with errors when checking if a dir entry exists during log replay
authorFilipe Manana <fdmanana@suse.com>
Fri, 1 Oct 2021 12:52:30 +0000 (13:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Oct 2021 07:53:14 +0000 (09:53 +0200)
commitf03a8a85e91580f7881b24c24ab2e4e37d8080b1
treef81dc64f001a52b8e300550d7c1892f7b2036bcd
parent4eda4cf24c9b1f2792697c9841f4ee480824cc86
btrfs: deal with errors when checking if a dir entry exists during log replay

[ Upstream commit 77a5b9e3d14cbce49ceed2766b2003c034c066dc ]

Currently inode_in_dir() ignores errors returned from
btrfs_lookup_dir_index_item() and from btrfs_lookup_dir_item(), treating
any errors as if the directory entry does not exists in the fs/subvolume
tree, which is obviously not correct, as we can get errors such as -EIO
when reading extent buffers while searching the fs/subvolume's tree.

Fix that by making inode_in_dir() return the errors and making its only
caller, add_inode_ref(), deal with returned errors as well.

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>
fs/btrfs/tree-log.c