btrfs: fix missing error return in btrfs_drop_snapshot
diff mbox

Message ID 20171204181145.10335-1-jeffm@suse.com
State New
Headers show

Commit Message

Jeff Mahoney Dec. 4, 2017, 6:11 p.m. UTC
From: Jeff Mahoney <jeffm@suse.com>

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: <stable@vger.kernel.org> # v3.4+
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/extent-tree.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba Dec. 4, 2017, 8:31 p.m. UTC | #1
On Mon, Dec 04, 2017 at 01:11:45PM -0500, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
> 
> 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: <stable@vger.kernel.org> # v3.4+
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4497f937e8fb..2f4328511ac8 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -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;
 	}