aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2011-06-01 10:57:14 +0200
committerJohn Rigby <john.rigby@linaro.org>2011-10-17 09:52:08 -0600
commita25648af002512347105865687a313f74aa8bd8e (patch)
tree45a2454e7971564aa30fc93356f6e036af6094db
parent96b8cdca1de8c1b57a7a4ced17a89be5b70fdbd8 (diff)
UBUNTU: ubuntu: overlayfs -- vfs: introduce clone_private_mount()
Overlayfs needs a private clone of the mount, so create a function for this and export to modules. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andy Whitcroft <apw@canonical.com>
-rw-r--r--fs/namespace.c17
-rw-r--r--include/linux/mount.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 7d3843fdaee..09138dcd95c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1494,6 +1494,23 @@ void drop_collected_mounts(struct vfsmount *mnt)
release_mounts(&umount_list);
}
+struct vfsmount *clone_private_mount(struct path *path)
+{
+ struct vfsmount *mnt;
+
+ if (IS_MNT_UNBINDABLE(path->mnt))
+ return ERR_PTR(-EINVAL);
+
+ down_read(&namespace_sem);
+ mnt = clone_mnt(path->mnt, path->dentry, CL_PRIVATE);
+ up_read(&namespace_sem);
+ if (!mnt)
+ return ERR_PTR(-ENOMEM);
+
+ return mnt;
+}
+EXPORT_SYMBOL_GPL(clone_private_mount);
+
int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
struct vfsmount *root)
{
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 604f122a232..44e9bf4d95c 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -100,6 +100,9 @@ extern void mnt_pin(struct vfsmount *mnt);
extern void mnt_unpin(struct vfsmount *mnt);
extern int __mnt_is_readonly(struct vfsmount *mnt);
+struct path;
+extern struct vfsmount *clone_private_mount(struct path *path);
+
extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
const char *name, void *data);