linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	dhowells@redhat.com
Subject: [RFC PATCH 1/8] vfs: Add a single-or-reconfig keying to vfs_get_super()
Date: Thu, 21 Mar 2019 11:47:43 +0000	[thread overview]
Message-ID: <155316886354.29437.8797952998692804823.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <155316885201.29437.3428987891437242750.stgit@warthog.procyon.org.uk>

Add an additional keying mode to vfs_get_super() to indicate that only a
single superblock should exist in the system, and that, if it does, further
mounts should invoke reconfiguration upon it.

This allows mount_single() to be replaced.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/super.c                 |   18 +++++++++++++-----
 include/linux/fs_context.h |    1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 6d8dbf309241..fa1d697b73bb 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1175,9 +1175,11 @@ int vfs_get_super(struct fs_context *fc,
 {
 	int (*test)(struct super_block *, struct fs_context *);
 	struct super_block *sb;
+	int err;
 
 	switch (keying) {
 	case vfs_get_single_super:
+	case vfs_get_single_reconf_super:
 		test = test_single_super;
 		break;
 	case vfs_get_keyed_super:
@@ -1195,18 +1197,24 @@ int vfs_get_super(struct fs_context *fc,
 		return PTR_ERR(sb);
 
 	if (!sb->s_root) {
-		int err = fill_super(sb, fc);
-		if (err) {
-			deactivate_locked_super(sb);
-			return err;
-		}
+		err = fill_super(sb, fc);
+		if (err)
+			goto error;
 
 		sb->s_flags |= SB_ACTIVE;
+	} else if (keying == vfs_get_single_reconf_super) {
+		err = reconfigure_super(fc);
+		if (err < 0)
+			goto error;
 	}
 
 	BUG_ON(fc->root);
 	fc->root = dget(sb->s_root);
 	return 0;
+
+error:
+	deactivate_locked_super(sb);
+	return err;
 }
 EXPORT_SYMBOL(vfs_get_super);
 
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index 8233c873af73..f1ed5ea0a041 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -136,6 +136,7 @@ extern int vfs_init_pseudo_fs_context(struct fs_context *fc,
  */
 enum vfs_get_super_keying {
 	vfs_get_single_super,	/* Only one such superblock may exist */
+	vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */
 	vfs_get_keyed_super,	/* Superblocks with different s_fs_info keys may exist */
 	vfs_get_independent_super, /* Multiple independent superblocks may exist */
 };


  reply	other threads:[~2019-03-21 11:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 11:47 [RFC PATCH 0/8] Convert mount_single-using filesystems to fs_context David Howells
2019-03-21 11:47 ` David Howells [this message]
2019-03-21 11:47 ` [RFC PATCH 2/8] vfs: Convert debugfs " David Howells
2019-03-21 11:47 ` [RFC PATCH 3/8] vfs: Convert tracefs " David Howells
2019-03-21 12:58   ` Steven Rostedt
2019-03-21 15:49   ` David Howells
2019-03-21 15:59     ` Steven Rostedt
2019-03-21 17:13     ` David Howells
2019-03-21 15:50   ` David Howells
2019-03-21 11:48 ` [RFC PATCH 4/8] vfs: Convert pstore " David Howells
2019-03-21 16:31   ` Kees Cook
2019-03-21 17:03   ` David Howells
2019-03-21 17:35     ` Kees Cook
2019-03-21 11:48 ` [RFC PATCH 5/8] hypfs: Fix error number left in struct pointer member David Howells
2019-03-21 11:48 ` [RFC PATCH 6/8] vfs: Convert hypfs to fs_context David Howells
2019-03-21 11:48 ` [RFC PATCH 7/8] vfs: Convert spufs " David Howells
2019-03-21 11:48 ` [RFC PATCH 8/8] vfs: Kill off mount_single() David Howells

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=155316886354.29437.8797952998692804823.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).