linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix missing error return in btrfs_drop_snapshot
@ 2017-12-04 18:11 jeffm
  2017-12-04 20:31 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: jeffm @ 2017-12-04 18:11 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Jeff Mahoney, stable

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(+)

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;
 	}
 
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: fix missing error return in btrfs_drop_snapshot
  2017-12-04 18:11 [PATCH] btrfs: fix missing error return in btrfs_drop_snapshot jeffm
@ 2017-12-04 20:31 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-12-04 20:31 UTC (permalink / raw)
  To: jeffm; +Cc: linux-btrfs, stable

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-04 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 18:11 [PATCH] btrfs: fix missing error return in btrfs_drop_snapshot jeffm
2017-12-04 20:31 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).