Skip to content

Commit a2770d8

Browse files
committed
Revert "fix mismerge with Trond's stuff (create_mnt_ns() export is gone now)"
This reverts commit e9496ff. Quoth Al: "it's dependent on a lot of other stuff not currently in mainline and badly broken with current fs/namespace.c. Sorry, badly out-of-order cherry-pick from old queue. PS: there's a large pending series reworking the refcounting and lifetime rules for vfsmounts that will, among other things, allow to rip a subtree away _without_ dissolving connections in it, to be garbage-collected when all active references are gone. It's considerably saner wrt "is the subtree busy" logics, but it's nowhere near being ready for merge at the moment; this changeset is one of the things becoming possible with that sucker, but it certainly shouldn't have been picked during this cycle. My apologies..." Noticed-by: Eric Paris <eparis@redhat.com> Requested-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b8a7f3c commit a2770d8

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎fs/namespace.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
20682068
* create_mnt_ns - creates a private namespace and adds a root filesystem
20692069
* @mnt: pointer to the new root filesystem mountpoint
20702070
*/
2071-
static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
2071+
struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
20722072
{
20732073
struct mnt_namespace *new_ns;
20742074

@@ -2080,6 +2080,7 @@ static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
20802080
}
20812081
return new_ns;
20822082
}
2083+
EXPORT_SYMBOL(create_mnt_ns);
20832084

20842085
SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
20852086
char __user *, type, unsigned long, flags, void __user *, data)

‎fs/nfs/super.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,13 +2648,21 @@ static void nfs_fix_devname(const struct path *path, struct vfsmount *mnt)
26482648
static int nfs_follow_remote_path(struct vfsmount *root_mnt,
26492649
const char *export_path, struct vfsmount *mnt_target)
26502650
{
2651+
struct mnt_namespace *ns_private;
26512652
struct nameidata nd;
26522653
struct super_block *s;
26532654
int ret;
26542655

2656+
ns_private = create_mnt_ns(root_mnt);
2657+
ret = PTR_ERR(ns_private);
2658+
if (IS_ERR(ns_private))
2659+
goto out_mntput;
2660+
26552661
ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
26562662
export_path, LOOKUP_FOLLOW, &nd);
26572663

2664+
put_mnt_ns(ns_private);
2665+
26582666
if (ret != 0)
26592667
goto out_err;
26602668

‎include/linux/mnt_namespace.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct proc_mounts {
2323

2424
struct fs_struct;
2525

26+
extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
2627
extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
2728
struct fs_struct *);
2829
extern void put_mnt_ns(struct mnt_namespace *ns);

0 commit comments

Comments
 (0)