[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460734532-20134-3-git-send-email-ebiederm@xmission.com>
Date: Fri, 15 Apr 2016 10:35:19 -0500
From: "Eric W. Biederman" <ebiederm@...ssion.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>, security@...ian.org,
security@...nel.org, Al Viro <viro@...iv.linux.org.uk>,
security@...ntu.com, Peter Hurley <peter@...leysoftware.com>,
Serge Hallyn <serge.hallyn@...ntu.com>,
Willy Tarreau <w@....eu>,
Aurelien Jarno <aurelien@...el32.net>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
Jann Horn <jann@...jh.net>, Greg KH <greg@...ah.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jiri Slaby <jslaby@...e.com>,
Florian Weimer <fw@...eb.enyo.de>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: [PATCH 03/16] vfs: Implement vfs_loopback_mount
Add a helper to turn a struct path into a mount.
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
fs/namespace.c | 9 +++++++++
include/linux/mount.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/fs/namespace.c b/fs/namespace.c
index 4fb1691b4355..714778360c2b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1047,6 +1047,15 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
return ERR_PTR(err);
}
+struct vfsmount *vfs_loopback_mount(struct path *path)
+{
+ struct mount *p;
+ p = clone_mnt(real_mount(path->mnt), path->dentry, 0);
+ if (IS_ERR(p))
+ return ERR_CAST(p);
+ return &p->mnt;
+}
+
static void cleanup_mnt(struct mount *mnt)
{
/*
diff --git a/include/linux/mount.h b/include/linux/mount.h
index f822c3c11377..8f6039ad898e 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -89,6 +89,7 @@ struct file_system_type;
extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
int flags, const char *name,
void *data);
+struct vfsmount *vfs_loopback_mount(struct path *path);
extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
extern void mark_mounts_for_expiry(struct list_head *mounts);
--
2.8.1
Powered by blists - more mailing lists