From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org
Cc: Seth Forshee <seth.forshee@digitalocean.com>,
Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Subject: [PATCH 6/7] fs: don't open-code mnt_hold_writers()
Date: Thu, 3 Feb 2022 14:14:10 +0100 [thread overview]
Message-ID: <20220203131411.3093040-7-brauner@kernel.org> (raw)
In-Reply-To: <20220203131411.3093040-1-brauner@kernel.org>
Remove sb_prepare_remount_readonly()'s open-coded mnt_hold_writers()
implementation with the real helper we introduced in commit fbdc2f6c40f6
("fs: split out functions to hold writers").
Cc: Seth Forshee <seth.forshee@digitalocean.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/namespace.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index ddae5c08ea8c..00762f9a736a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -563,12 +563,9 @@ int sb_prepare_remount_readonly(struct super_block *sb)
lock_mount_hash();
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
- mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
- smp_mb();
- if (mnt_get_writers(mnt) > 0) {
- err = -EBUSY;
+ err = mnt_hold_writers(mnt);
+ if (err)
break;
- }
}
}
if (!err && atomic_long_read(&sb->s_remove_count))
--
2.32.0
next prev parent reply other threads:[~2022-02-03 13:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 13:14 [PATCH 0/7] mount_setattr fixes Christian Brauner
2022-02-03 13:14 ` [PATCH 1/7] tests: fix idmapped mount_setattr test Christian Brauner
2022-02-07 6:50 ` Christoph Hellwig
2022-02-03 13:14 ` [PATCH 2/7] MAINTAINERS: add entry for idmapped mounts Christian Brauner
2022-02-07 6:50 ` Christoph Hellwig
2022-02-03 13:14 ` [PATCH 3/7] fs: add kernel doc for mnt_{hold,unhold}_writers() Christian Brauner
2022-02-07 6:51 ` Christoph Hellwig
2022-02-03 13:14 ` [PATCH 4/7] fs: add mnt_allow_writers() and simplify mount_setattr_prepare() Christian Brauner
2022-02-07 6:51 ` Christoph Hellwig
2022-02-03 13:14 ` [PATCH 5/7] fs: simplify check in mount_setattr_commit() Christian Brauner
2022-02-07 6:52 ` Christoph Hellwig
2022-02-03 13:14 ` Christian Brauner [this message]
2022-02-07 6:52 ` [PATCH 6/7] fs: don't open-code mnt_hold_writers() Christoph Hellwig
2022-02-03 13:14 ` [PATCH 7/7] fs: clean up mount_setattr control flow Christian Brauner
2022-02-07 6:53 ` Christoph Hellwig
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=20220203131411.3093040-7-brauner@kernel.org \
--to=brauner@kernel.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=seth.forshee@digitalocean.com \
--cc=viro@zeniv.linux.org.uk \
/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).