Skip to contentSkip to conversation

fs: Remove internal old mount API code

PATCH Applied Eric Sandeen 4 participants 4 messages Dec 12, 2025 – Dec 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: Remove internal old mount API code

Now that the last in-tree filesystem has been converted to the new mount API, remove all legacy mount API code designed to handle un-converted filesystems, and remove associated documentation as well.

(The code to handle the legacy mount(2) syscall from userspace is still in place, of course.)

Tested with an allmodconfig build on x86_64, and a sanity check of an old mount(2) syscall mount.

---
 Documentation/filesystems/locking.rst   |   8 -
 Documentation/filesystems/mount_api.rst |   2 -
 Documentation/filesystems/porting.rst   |   7 +-
 Documentation/filesystems/vfs.rst       |  58 +------
 fs/fs_context.c                         | 208 +-----------------------
 fs/fsopen.c                             |  10 --
 fs/internal.h                           |   1 -
 include/linux/fs.h                      |   2 -
 include/linux/fs/super_types.h          |   1 -
 9 files changed, 8 insertions(+), 289 deletions(-)
Documentation/filesystems/locking.rst +0 -8
index 77704fde9845..cc832074c8bb 100644
@@ -177,7 +177,6 @@ prototypes::
 	int (*freeze_fs) (struct super_block *);
 	int (*unfreeze_fs) (struct super_block *);
 	int (*statfs) (struct dentry *, struct kstatfs *);
-	int (*remount_fs) (struct super_block *, int *, char *);
 	void (*umount_begin) (struct super_block *);
 	int (*show_options)(struct seq_file *, struct dentry *);
 	ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
@@ -201,7 +200,6 @@ sync_fs:		read
 freeze_fs:		write
 unfreeze_fs:		write
 statfs:			maybe(read)	(see below)
-remount_fs:		write
 umount_begin:		no
 show_options:		no		(namespace_sem)
 quota_read:		no		(see below)
@@ -226,8 +224,6 @@ file_system_type
 
 prototypes::
 
-	struct dentry *(*mount) (struct file_system_type *, int,
-		       const char *, void *);
 	void (*kill_sb) (struct super_block *);
 
 locking rules:
@@ -235,13 +231,9 @@ locking rules:
 =======		=========
 ops		may block
 =======		=========
-mount		yes
 kill_sb		yes
 =======		=========
 
-->mount() returns ERR_PTR or the root dentry; its superblock should be locked
-on return.
-
 ->kill_sb() takes a write-locked superblock, does all shutdown work on it,
 unlocks and drops the reference.
 
Documentation/filesystems/mount_api.rst +0 -2
index c99ab1f7fea4..a064234fed5b 100644
@@ -299,8 +299,6 @@ manage the filesystem context.  They are as follows:
      On success it should return 0.  In the case of an error, it should return
      a negative error code.
 
-     .. Note:: reconfigure is intended as a replacement for remount_fs.
-
 
 Filesystem context Security
 ===========================
Documentation/filesystems/porting.rst +2 -5
index 3397937ed838..631eee9bdc33 100644
@@ -448,11 +448,8 @@ a file off.
 
 **mandatory**
 
-->get_sb() is gone.  Switch to use of ->mount().  Typically it's just
-a matter of switching from calling ``get_sb_``... to ``mount_``... and changing
-the function type.  If you were doing it manually, just switch from setting
-->mnt_root to some pointer to returning that pointer.  On errors return
-ERR_PTR(...).
+->get_sb() and ->mount() are gone. Switch to using the new mount API. See
+Documentation/filesystems/mount_api.rst for more details.
 
 ---
 
Documentation/filesystems/vfs.rst +3 -55

94 lines not on this page · raw message

fs/fs_context.c +3 -205

244 lines not on this page · raw message

fs/fsopen.c +0 -10
index f645c99204eb..622ee3926cd5 100644
@@ -404,16 +404,6 @@ SYSCALL_DEFINE5(fsconfig,
 		return -EINVAL;
 
 	fc = fd_file(f)->private_data;
-	if (fc->ops == &legacy_fs_context_ops) {
-		switch (cmd) {
-		case FSCONFIG_SET_BINARY:
-		case FSCONFIG_SET_PATH:
-		case FSCONFIG_SET_PATH_EMPTY:
-		case FSCONFIG_SET_FD:
-		case FSCONFIG_CMD_CREATE_EXCL:
-			return -EOPNOTSUPP;
-		}
-	}
 
 	if (_key) {
 		param.key = strndup_user(_key, 256);
fs/internal.h +0 -1
index ab638d41ab81..e333b105337a 100644
@@ -44,7 +44,6 @@ extern void __init chrdev_init(void);
 /*
  * fs_context.c
  */
-extern const struct fs_context_operations legacy_fs_context_ops;
 extern int parse_monolithic_mount_data(struct fs_context *, void *);
 extern void vfs_clean_context(struct fs_context *fc);
 extern int finish_clean_context(struct fs_context *fc);
include/linux/fs.h +0 -2
index 04ceeca12a0d..9949d253e5aa 100644
@@ -2274,8 +2274,6 @@ struct file_system_type {
 #define FS_RENAME_DOES_D_MOVE	32768	/* FS will handle d_move() during rename() internally. */
 	int (*init_fs_context)(struct fs_context *);
 	const struct fs_parameter_spec *parameters;
-	struct dentry *(*mount) (struct file_system_type *, int,
-		       const char *, void *);
 	void (*kill_sb) (struct super_block *);
 	struct module *owner;
 	struct file_system_type * next;
include/linux/fs/super_types.h +0 -1
index 6bd3009e09b3..4bb9981af6ac 100644
@@ -96,7 +96,6 @@ struct super_operations {
 			  const void *owner);
 	int (*unfreeze_fs)(struct super_block *sb);
 	int (*statfs)(struct dentry *dentry, struct kstatfs *kstatfs);
-	int (*remount_fs) (struct super_block *, int *, char *);
 	void (*umount_begin)(struct super_block *sb);
 
 	int (*show_options)(struct seq_file *seq, struct dentry *dentry);
Signature · 1 line
2.52.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Eric Sandeen

Now that the last in-tree filesystem has been converted to the new mount API, remove all legacy mount API code designed to handle un-converted filesystems, and remove associated documentation as well.

(The code to handle the legacy mount(2) syscall from userspace is still in place, of course.)

[...]

I love this. Thanks for all the work on this! :)

---

Applied to the vfs-6.20.namespace branch of the vfs/vfs.git tree. Patches in the vfs-6.20.namespace branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.20.namespace

[1/1] fs: Remove internal old mount API code

      https://git.kernel.org/vfs/vfs/c/51a146e0595c
#2 lore raw
Quoted 11 lines · Christian Brauner
Quoted 8 lines · Eric Sandeen

Now that the last in-tree filesystem has been converted to the new mount API, remove all legacy mount API code designed to handle un-converted filesystems, and remove associated documentation as well.

(The code to handle the legacy mount(2) syscall from userspace is still in place, of course.)

[...]

I love this. Thanks for all the work on this! :)

"Of the 56 or so kernel filesystems, around 30 still remain to be converted, Sandeen said, so he has been joking that the completion of the effort will be in 2026."

*phew* just under the wire ;)

-Eric

#3 lore raw
In reply to Christian Brauner
Quoted 10 lines · Christian Brauner
Quoted 8 lines · Eric Sandeen

Now that the last in-tree filesystem has been converted to the new mount API, remove all legacy mount API code designed to handle un-converted filesystems, and remove associated documentation as well.

(The code to handle the legacy mount(2) syscall from userspace is still in place, of course.)

[...]

I love this. Thanks for all the work on this! :)

Indeed, this is one time I really do wish I'd been able to do more on this.

Ian

Quoted 21 lines

---

Applied to the vfs-6.20.namespace branch of the vfs/vfs.git tree. Patches in the vfs-6.20.namespace branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.20.namespace

[1/1] fs: Remove internal old mount API code

       https://git.kernel.org/vfs/vfs/c/51a146e0595c