Skip to content

Commit e15ac64

Browse files
fdmananakdave
authored andcommitted
btrfs: deal with errors when replaying dir entry during log replay
At replay_one_one(), we are treating any error returned from btrfs_lookup_dir_item() or from btrfs_lookup_dir_index_item() as meaning that there is no existing directory entry in the fs/subvolume tree. This is not correct since we can get errors such as, for example, -EIO when reading extent buffers while searching the fs/subvolume's btree. So fix that and return the error to the caller when it is not -ENOENT. CC: [email protected] # 4.14+ Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 77a5b9e commit e15ac64

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,14 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
19881988
ret = -EINVAL;
19891989
goto out;
19901990
}
1991-
if (IS_ERR_OR_NULL(dst_di)) {
1991+
1992+
if (dst_di == ERR_PTR(-ENOENT))
1993+
dst_di = NULL;
1994+
1995+
if (IS_ERR(dst_di)) {
1996+
ret = PTR_ERR(dst_di);
1997+
goto out;
1998+
} else if (!dst_di) {
19921999
/* we need a sequence number to insert, so we only
19932000
* do inserts for the BTRFS_DIR_INDEX_KEY types
19942001
*/

0 commit comments

Comments
 (0)