Skip to contentSkip to conversation

btrfs: fix missing error return in btrfs_drop_snapshot

PATCH In review [email protected] 2 participants 2 messages Dec 4, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: fix missing error return in btrfs_drop_snapshot

From: Jeff Mahoney <[email protected]>

If btrfs_del_root fails in btrfs_drop_snapshot, we'll pick up the error but then return 0 anyway due to mixing err and ret.

Fixes 79787eaab4612 ("btrfs: replace many BUG_ONs with proper error handling")
Cc <[email protected]> # v3.4+
---
 fs/btrfs/extent-tree.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
index 4497f937e8fb..2f4328511ac8 100644
@@ -9206,6 +9206,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
 	ret = btrfs_del_root(trans, fs_info, &root->root_key);
 	if (ret) {
 		btrfs_abort_transaction(trans, ret);
+		err = ret;
 		goto out_end_trans;
 	}
 
Signature · 1 line
2.14.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Mon, Dec 04, 2017 at 01:11:45PM -0500, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

If btrfs_del_root fails in btrfs_drop_snapshot, we'll pick up the error but then return 0 anyway due to mixing err and ret.

Fixes 79787eaab4612 ("btrfs: replace many BUG_ONs with proper error handling")
Cc <[email protected]> # v3.4+