All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs: Abort transaction if btrfs_update_root fails in btrfs_ioctl_subvol_setflags
@ 2017-09-26 14:27 Nikolay Borisov
  2017-09-26 14:27 ` [RFC PATCH 2/2] btrfs: Remove received_uuid during received snapshot ro->rw switch Nikolay Borisov
  2017-09-26 17:39 ` [PATCH 1/2] btrfs: Abort transaction if btrfs_update_root fails in btrfs_ioctl_subvol_setflags David Sterba
  0 siblings, 2 replies; 21+ messages in thread
From: Nikolay Borisov @ 2017-09-26 14:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: fdmanana, Nikolay Borisov

btrfs_update_root can fail for any number of reasons, however the only error
handling we do is to revert the modified flags, yet we do not abort the
transaction but proceed to commit it. Fix this by explicitly checking if the
update root routine has failed and abort the transaction.

Fixes: 0caa102da827 ("Btrfs: Add BTRFS_IOC_SUBVOL_GETFLAGS/SETFLAGS ioctls")
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d6715c2bcdc4..09fcd51f0e8c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1842,8 +1842,11 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 
 	ret = btrfs_update_root(trans, fs_info->tree_root,
 				&root->root_key, &root->root_item);
+	if (ret < 0)
+		btrfs_abort_transaction(trans, ret);
 
 	btrfs_commit_transaction(trans);
+
 out_reset:
 	if (ret)
 		btrfs_set_root_flags(&root->root_item, root_flags);
-- 
2.7.4


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

end of thread, other threads:[~2017-11-12 17:11 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 14:27 [PATCH 1/2] btrfs: Abort transaction if btrfs_update_root fails in btrfs_ioctl_subvol_setflags Nikolay Borisov
2017-09-26 14:27 ` [RFC PATCH 2/2] btrfs: Remove received_uuid during received snapshot ro->rw switch Nikolay Borisov
2017-09-27  8:53   ` [PATCH v2] " Nikolay Borisov
2017-09-26 17:39 ` [PATCH 1/2] btrfs: Abort transaction if btrfs_update_root fails in btrfs_ioctl_subvol_setflags David Sterba
2017-09-27  8:48   ` Nikolay Borisov
2017-09-27 14:00     ` David Sterba
2017-09-27 14:28       ` Nikolay Borisov
2017-09-28  7:53       ` [PATCH 1/2] btrfs: Explicitly handle btrfs_update_root failure Nikolay Borisov
2017-09-28  7:53         ` [PATCH v3 2/2] btrfs: Remove received_uuid during received snapshot ro->rw switch Nikolay Borisov
2017-09-29 17:56           ` David Sterba
2017-09-29 19:15             ` Nikolay Borisov
2017-10-04 15:00               ` David Sterba
2017-10-05  8:22                 ` [PATCH v4] " Nikolay Borisov
2017-10-05  9:03                   ` Anand Jain
2017-10-06 17:24                     ` David Sterba
2017-10-06 17:49                       ` Hans van Kranenburg
2017-10-06 20:07                         ` Andrei Borzenkov
2017-10-06 21:27                           ` Hans van Kranenburg
2017-10-07  7:56                             ` Andrei Borzenkov
2017-11-12 17:11                   ` Hans van Kranenburg
2017-09-29 17:42         ` [PATCH 1/2] btrfs: Explicitly handle btrfs_update_root failure David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.