Skip to content

Commit 0b7453b

Browse files
fdmananakdave
authored andcommitted
btrfs: abort transaction if we fail to find dir item during log replay
At __add_inode_ref() if we get an error when trying to lookup a dir item we don't abort the transaction and propagate the error up the call chain, so that somewhere else up in the call chain the transaction is aborted. This however makes it hard to know that the failure comes from looking up a dir item, so add a transaction abort in case we fail there, so that we immediately pinpoint where the problem comes from during log replay. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent e41c5e6 commit 0b7453b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/btrfs/tree-log.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,9 @@ static inline int __add_inode_ref(struct walk_control *wc,
12811281
/* look for a conflicting name */
12821282
di = btrfs_lookup_dir_item(trans, root, wc->subvol_path, btrfs_ino(dir), name, 0);
12831283
if (IS_ERR(di)) {
1284-
return PTR_ERR(di);
1284+
ret = PTR_ERR(di);
1285+
btrfs_abort_transaction(trans, ret);
1286+
return ret;
12851287
} else if (di) {
12861288
ret = drop_one_dir_item(wc, dir, di);
12871289
if (ret)

0 commit comments

Comments
 (0)