From: Al Viro <viro@zeniv.linux.org.uk>
To: David Sterba <dsterba@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [RFC][PATCH] btrfs_get_tree_subvol(): switch from fc_mount() to vfs_create_mount()
Date: Mon, 5 May 2025 20:21:11 +0100 [thread overview]
Message-ID: <20250505192111.GH2023217@ZenIV> (raw)
In-Reply-To: <20250505175807.GB9140@twin.jikos.cz>
On Mon, May 05, 2025 at 07:58:07PM +0200, David Sterba wrote:
> > - if (fc->sb_flags & SB_RDONLY)
> > - return ret;
> > -
> > - down_write(&mnt->mnt_sb->s_umount);
> > - if (!(fc->sb_flags & SB_RDONLY) && (mnt->mnt_sb->s_flags & SB_RDONLY))
> > + if (!(fc->sb_flags & SB_RDONLY) && (fc->root->d_sb->s_flags & SB_RDONLY))
> > ret = btrfs_reconfigure(fc);
> > - up_write(&mnt->mnt_sb->s_umount);
> So this open codes fc_mount(), which is vfs_get_tree() + vfs_create_mount(),
> the only difference I see in the new code is that
> btrfs_reconfigure_for_mount() dropped the SB_RDONLY check.
>
> Why the check is there is explained in the lengthy comment above
> btrfs_reconfigure_for_mount(), so it should stay. If it can be removed
> then it should be a separate patch from the cleanup.
What do you mean, dropped? It's still right there - the current
variant checks it *twice*, once before grabbing ->s_umount, then
after it's been grabbed. Checking it before down_write() makes sense
if we are called after ->s_umount had been dropped (by fc_mount()).
I'm not sure why you recheck it after down_write(), since it's not
going to change, but you do recheck it. In this variant we don't need
to bother grabbing the rwsem, since that thing is called while ->s_umount
is still held...
I can turn that into
if (fc->sb_flags & SB_RDONLY)
return ret;
if (fc->root->d_sb->s_flags & SB_RDONLY)
ret = btrfs_reconfigure(fc);
return ret;
but I don't see how it's better than the variant posted; up to you, of course...
next prev parent reply other threads:[~2025-05-05 19:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 3:03 [RFC][PATCH] btrfs_get_tree_subvol(): switch from fc_mount() to vfs_create_mount() Al Viro
2025-05-05 17:58 ` David Sterba
2025-05-05 19:21 ` Al Viro [this message]
2025-05-06 13:36 ` Klara Modin
2025-05-06 16:43 ` Al Viro
2025-05-06 16:48 ` Klara Modin
2025-05-06 17:25 ` Al Viro
2025-05-06 17:47 ` Klara Modin
2025-05-06 17:51 ` Al Viro
2025-05-06 17:54 ` Klara Modin
2025-05-06 18:16 ` Al Viro
2025-05-06 18:34 ` Klara Modin
2025-05-06 19:05 ` Al Viro
2025-05-06 19:20 ` Klara Modin
2025-05-06 19:48 ` Al Viro
2025-05-06 18:58 ` Klara Modin
2025-05-06 19:33 ` Al Viro
2025-05-06 19:44 ` Klara Modin
2025-05-06 19:34 ` [PATCH v2] " Al Viro
2025-05-06 19:52 ` Klara Modin
2025-05-06 20:00 ` Al Viro
2025-05-06 19:58 ` [PATCH v3] " Al Viro
2025-05-08 9:29 ` Qu Wenruo
2025-06-03 7:59 ` David Sterba
2025-06-03 9:23 ` Qu Wenruo
2025-06-03 19:38 ` David Sterba
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=20250505192111.GH2023217@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--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 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.