aboutsummaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-05-14 13:06:13 +0200
committerJohn Rigby <john.rigby@linaro.org>2012-06-25 15:02:25 -0600
commitb6b7eb678036d05af00f957b7f190fe576c49100 (patch)
treec3e940c6e0e751ce213030c41f98b351df54f3ac /fs/namespace.c
parent336d839d58edb7dde1d5db4d03ec1e19ab545ee9 (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>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 7db5f2b1527..6731fc258b3 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1327,6 +1327,24 @@ void drop_collected_mounts(struct vfsmount *mnt)
release_mounts(&umount_list);
}
+struct vfsmount *clone_private_mount(struct path *path)
+{
+ struct mount *old_mnt = real_mount(path->mnt);
+ struct mount *new_mnt;
+
+ if (IS_MNT_UNBINDABLE(old_mnt))
+ return ERR_PTR(-EINVAL);
+
+ down_read(&namespace_sem);
+ new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
+ up_read(&namespace_sem);
+ if (!new_mnt)
+ return ERR_PTR(-ENOMEM);
+
+ return &new_mnt->mnt;
+}
+EXPORT_SYMBOL_GPL(clone_private_mount);
+
int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
struct vfsmount *root)
{