mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
btrfs: fix lost error handling when looking up extended ref on log replay
commit7a6b75b799
upstream. During log replay, when processing inode references, if we get an error when looking up for an extended reference at __add_inode_ref(), we ignore it and proceed, returning success (0) if no other error happens after the lookup. This is obviously wrong because in case an extended reference exists and it encodes some name not in the log, we need to unlink it, otherwise the filesystem state will not match the state it had after the last fsync. So just make __add_inode_ref() return an error it gets from the extended reference lookup. Fixes:f186373fef
("btrfs: extended inode refs") CC: stable@vger.kernel.org # 4.9+ 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
70f7fca811
commit
6a58c948b9
1 changed files with 3 additions and 1 deletions
|
@ -1100,7 +1100,9 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
|
|||
extref = btrfs_lookup_inode_extref(NULL, root, path, name, namelen,
|
||||
inode_objectid, parent_objectid, 0,
|
||||
0);
|
||||
if (!IS_ERR_OR_NULL(extref)) {
|
||||
if (IS_ERR(extref)) {
|
||||
return PTR_ERR(extref);
|
||||
} else if (extref) {
|
||||
u32 item_size;
|
||||
u32 cur_offset = 0;
|
||||
unsigned long base;
|
||||
|
|
Loading…
Reference in a new issue