diff mbox series

[04/11] VFS: export lookup_mnt()

Message ID 162742546551.32498.5847026750506620683.stgit@noble.brown (mailing list archive)
State New, archived
Headers show
Series expose btrfs subvols in mount table correctly | expand

Commit Message

NeilBrown July 27, 2021, 10:37 p.m. UTC
In order to support filehandle lookup in filesystems with internal
mounts (multiple subvols in the one filesystem) reconnect_path() in
exportfs will need to find out if a given dentry is already mounted.
This can be done with the function lookup_mnt(), so export that to make
it available.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/internal.h         |    1 -
 fs/namespace.c        |    1 +
 include/linux/mount.h |    2 ++
 3 files changed, 3 insertions(+), 1 deletion(-)

Comments

Al Viro July 30, 2021, 12:31 a.m. UTC | #1
On Wed, Jul 28, 2021 at 08:37:45AM +1000, NeilBrown wrote:
> In order to support filehandle lookup in filesystems with internal
> mounts (multiple subvols in the one filesystem) reconnect_path() in
> exportfs will need to find out if a given dentry is already mounted.
> This can be done with the function lookup_mnt(), so export that to make
> it available.

IMO having exportfs modular is wrong - note that fs/fhandle.c is
	* calling functions in exportfs
	* non-modular
	* ... and not going to be modular, no matter what - there
are syscalls in it.
NeilBrown July 30, 2021, 5:33 a.m. UTC | #2
On Fri, 30 Jul 2021, Al Viro wrote:
> On Wed, Jul 28, 2021 at 08:37:45AM +1000, NeilBrown wrote:
> > In order to support filehandle lookup in filesystems with internal
> > mounts (multiple subvols in the one filesystem) reconnect_path() in
> > exportfs will need to find out if a given dentry is already mounted.
> > This can be done with the function lookup_mnt(), so export that to make
> > it available.
> 
> IMO having exportfs modular is wrong - note that fs/fhandle.c is
> 	* calling functions in exportfs
> 	* non-modular
> 	* ... and not going to be modular, no matter what - there
> are syscalls in it.
> 
> 

I agree - it makes sense for exportfs to be non-module.  It cannot be
module if FHANDLE is enabled, and if you don't want FHANDLE you probably
don't want EXPORTFS either.

Thanks,
NeilBrown
diff mbox series

Patch

diff --git a/fs/internal.h b/fs/internal.h
index 3ce8edbaa3ca..0feb2722d2e5 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -81,7 +81,6 @@  int do_renameat2(int olddfd, struct filename *oldname, int newdfd,
 /*
  * namespace.c
  */
-extern struct vfsmount *lookup_mnt(const struct path *);
 extern int finish_automount(struct vfsmount *, struct path *);
 
 extern int sb_prepare_remount_readonly(struct super_block *);
diff --git a/fs/namespace.c b/fs/namespace.c
index 81b0f2b2e701..73bbdb921e24 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -662,6 +662,7 @@  struct vfsmount *lookup_mnt(const struct path *path)
 	rcu_read_unlock();
 	return m;
 }
+EXPORT_SYMBOL(lookup_mnt);
 
 static inline void lock_ns_list(struct mnt_namespace *ns)
 {
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 5d92a7e1a742..1d3daed88f83 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -118,6 +118,8 @@  extern unsigned int sysctl_mount_max;
 
 extern bool path_is_mountpoint(const struct path *path);
 
+extern struct vfsmount *lookup_mnt(const struct path *);
+
 extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
 
 #endif /* _LINUX_MOUNT_H */