From: Christian Brauner Date: Thu, 3 Feb 2022 13:14:10 +0000 (+0100) Subject: fs: don't open-code mnt_hold_writers() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ad1844a0127af8fbb87d3d7019907260daf6466b;p=linux.git fs: don't open-code mnt_hold_writers() 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"). Link: https://lore.kernel.org/r/20220203131411.3093040-7-brauner@kernel.org Cc: Seth Forshee Cc: Christoph Hellwig Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Christian Brauner --- diff --git a/fs/namespace.c b/fs/namespace.c index ddae5c08ea8c8..00762f9a736a4 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))