linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, Christian Brauner <brauner@kernel.org>
Subject: [PATCH RFC 2/6] xfs: simplify device handling
Date: Tue, 24 Oct 2023 16:53:40 +0200	[thread overview]
Message-ID: <20231024-vfs-super-rework-v1-2-37a8aa697148@kernel.org> (raw)
In-Reply-To: <20231024-vfs-super-rework-v1-0-37a8aa697148@kernel.org>

We removed all codepaths where s_umount is taken beneath open_mutex and
bd_holder_lock so don't make things more complicated than they need to
be and hold s_umount over block device opening.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/xfs/xfs_super.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index f0ae07828153..84107d162e41 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -437,19 +437,13 @@ xfs_open_devices(
 	struct bdev_handle	*logdev_handle = NULL, *rtdev_handle = NULL;
 	int			error;
 
-	/*
-	 * blkdev_put() can't be called under s_umount, see the comment
-	 * in get_tree_bdev() for more details
-	 */
-	up_write(&sb->s_umount);
-
 	/*
 	 * Open real time and log devices - order is important.
 	 */
 	if (mp->m_logname) {
 		error = xfs_blkdev_get(mp, mp->m_logname, &logdev_handle);
 		if (error)
-			goto out_relock;
+			return error;
 	}
 
 	if (mp->m_rtname) {
@@ -492,10 +486,7 @@ xfs_open_devices(
 			bdev_release(logdev_handle);
 	}
 
-	error = 0;
-out_relock:
-	down_write(&sb->s_umount);
-	return error;
+	return 0;
 
  out_free_rtdev_targ:
 	if (mp->m_rtdev_targp)
@@ -508,7 +499,7 @@ xfs_open_devices(
  out_close_logdev:
 	if (logdev_handle)
 		bdev_release(logdev_handle);
-	goto out_relock;
+	return error;
 }
 
 /*
@@ -758,10 +749,6 @@ static void
 xfs_mount_free(
 	struct xfs_mount	*mp)
 {
-	/*
-	 * Free the buftargs here because blkdev_put needs to be called outside
-	 * of sb->s_umount, which is held around the call to ->put_super.
-	 */
 	if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp)
 		xfs_free_buftarg(mp->m_logdev_targp);
 	if (mp->m_rtdev_targp)

-- 
2.34.1


  parent reply	other threads:[~2023-10-24 14:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 14:53 [PATCH RFC 0/6] fs,block: yield devices Christian Brauner
2023-10-24 14:53 ` [PATCH RFC 1/6] fs: simplify setup_bdev_super() calls Christian Brauner
2023-10-25 15:29   ` Jan Kara
2023-10-27  6:42   ` Christoph Hellwig
2023-10-24 14:53 ` Christian Brauner [this message]
2023-10-25 15:30   ` [PATCH RFC 2/6] xfs: simplify device handling Jan Kara
2023-10-27  6:42   ` Christoph Hellwig
2023-10-24 14:53 ` [PATCH RFC 3/6] ext4: " Christian Brauner
2023-10-25 15:30   ` Jan Kara
2023-10-27  6:42   ` Christoph Hellwig
2023-10-24 14:53 ` [PATCH RFC 4/6] bdev: simplify waiting for concurrent claimers Christian Brauner
2023-10-25 15:54   ` Jan Kara
2023-10-27  7:21     ` Christoph Hellwig
2023-10-24 14:53 ` [PATCH RFC 5/6] block: mark device as about to be released Christian Brauner
2023-10-24 14:53 ` [PATCH RFC 6/6] fs: add ->yield_devices() Christian Brauner
2023-10-25 17:20 ` [PATCH RFC 0/6] fs,block: yield devices Jan Kara
2023-10-25 20:46   ` Christian Brauner
2023-10-26 10:35     ` Jan Kara
2023-10-26 12:07       ` Christian Brauner
2023-10-26 13:04         ` Jan Kara
2023-10-26 15:08           ` Christian Brauner
2023-10-26 15:58             ` Jan Kara
2023-10-27  7:24             ` Christoph Hellwig
2023-10-26 11:50 ` (subset) " Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231024-vfs-super-rework-v1-2-37a8aa697148@kernel.org \
    --to=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).