All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] btrfs: change commit txn to end txn in subvol_setflags ioctl
@ 2020-08-04 17:55 Boris Burkov
  2020-08-04 22:48 ` Qu Wenruo
  2020-08-26 14:23 ` Josef Bacik
  0 siblings, 2 replies; 8+ messages in thread
From: Boris Burkov @ 2020-08-04 17:55 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: linux-btrfs, kernel-team, Boris Burkov

Currently, btrfs_ioctl_subvol_setflags forces a btrfs_commit_transaction
while holding subvol_sem. As a result, we have seen workloads where
calling `btrfs property set -ts <subvol> ro false` hangs waiting for a
legitimately slow commit. This gets even worse if the workload tries to
set flags on multiple subvolumes and the ioctls pile up on subvol_sem.

Change the commit to a btrfs_end_transaction so that the ioctl can
return in a timely fashion and piggy back on a later commit.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 fs/btrfs/ioctl.c       | 2 +-
 fs/btrfs/transaction.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index bd3511c5ca81..3ae484768ce7 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1985,7 +1985,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 		goto out_reset;
 	}
 
-	ret = btrfs_commit_transaction(trans);
+	ret = btrfs_end_transaction(trans);
 
 out_reset:
 	if (ret)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 20c6ac1a5de7..1dc44209c2ae 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -47,7 +47,7 @@
  * | Will wait for previous running transaction to completely finish if there
  * | is one
  * |
- * | Then one of the following happes:
+ * | Then one of the following happens:
  * | - Wait for all other trans handle holders to release.
  * |   The btrfs_commit_transaction() caller will do the commit work.
  * | - Wait for current transaction to be committed by others.
@@ -60,7 +60,7 @@
  * |
  * | To next stage:
  * |  Caller is chosen to commit transaction N, and all other trans handle
- * |  haven been released.
+ * |  have been released.
  * V
  * Transaction N [[TRANS_STATE_COMMIT_DOING]]
  * |
-- 
2.24.1


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

end of thread, other threads:[~2020-08-26 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 17:55 [PATCH RFC] btrfs: change commit txn to end txn in subvol_setflags ioctl Boris Burkov
2020-08-04 22:48 ` Qu Wenruo
2020-08-04 23:08   ` Josef Bacik
2020-08-05 13:40     ` Martin Raiber
2020-08-07 20:45       ` Boris Burkov
2020-08-10 18:05         ` Martin Raiber
2020-08-25 20:23           ` Boris Burkov
2020-08-26 14:23 ` Josef Bacik

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.