diff mbox series

[01/18] fs: indicate request originates from old mount api

Message ID 75912547b45b70df4f5b7d19e2de8d5fda5c8167.1699308010.git.josef@toxicpanda.com (mailing list archive)
State New
Headers show
Series btrfs: convert to the new mount API | expand

Commit Message

Josef Bacik Nov. 6, 2023, 10:08 p.m. UTC
From: Christian Brauner <brauner@kernel.org>

We already communicate to filesystems when a remount request comes from
the old mount api as some filesystems choose to implement different
behavior in the new mount api than the old mount api to e.g., take the
chance to fix significant api bugs. Allow the same for regular mount
requests.

Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/namespace.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Christoph Hellwig Nov. 8, 2023, 7:59 a.m. UTC | #1
On Mon, Nov 06, 2023 at 05:08:09PM -0500, Josef Bacik wrote:
> From: Christian Brauner <brauner@kernel.org>
> 
> We already communicate to filesystems when a remount request comes from
> the old mount api as some filesystems choose to implement different
> behavior in the new mount api than the old mount api to e.g., take the
> chance to fix significant api bugs. Allow the same for regular mount
> requests.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

FYI, I'd be almost tempted to add a Fixes here - setting this flag
only for remounts in the old patch is almost asking for trouble..
diff mbox series

Patch

diff --git a/fs/namespace.c b/fs/namespace.c
index e157efc54023..bfc5cff0e196 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2873,7 +2873,12 @@  static int do_remount(struct path *path, int ms_flags, int sb_flags,
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	/*
+	 * Indicate to the filesystem that the remount request is coming
+	 * from the legacy mount system call.
+	 */
 	fc->oldapi = true;
+
 	err = parse_monolithic_mount_data(fc, data);
 	if (!err) {
 		down_write(&sb->s_umount);
@@ -3322,6 +3327,12 @@  static int do_new_mount(struct path *path, const char *fstype, int sb_flags,
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	/*
+	 * Indicate to the filesystem that the mount request is coming
+	 * from the legacy mount system call.
+	 */
+	fc->oldapi = true;
+
 	if (subtype)
 		err = vfs_parse_fs_string(fc, "subtype",
 					  subtype, strlen(subtype));