]> git.pld-linux.org Git - packages/kernel.git/blame - ovl03-vfs-introduce-clone_private_mount.patch
- add linux/version.h compatibility symlink
[packages/kernel.git] / ovl03-vfs-introduce-clone_private_mount.patch
CommitLineData
68184a5a
JR
1From 8271242be97498b40f49ece9202bf392df21ac29 Mon Sep 17 00:00:00 2001
2From: Miklos Szeredi <mszeredi@suse.cz>
3Date: Thu, 30 Aug 2012 16:13:49 +0200
4Subject: [PATCH 03/13] vfs: introduce clone_private_mount()
5Patch-mainline: not yet
6
7Overlayfs needs a private clone of the mount, so create a function for
8this and export to modules.
9
10Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
11---
12 fs/namespace.c | 18 ++++++++++++++++++
13 include/linux/mount.h | 3 +++
14 2 files changed, 21 insertions(+)
15
16Index: linux-3.6-rc7-master/fs/namespace.c
17===================================================================
18--- linux-3.6-rc7-master.orig/fs/namespace.c 2012-09-24 03:10:57.000000000 +0200
19+++ linux-3.6-rc7-master/fs/namespace.c 2012-09-28 13:36:51.000000000 +0200
20@@ -1387,6 +1387,24 @@ void drop_collected_mounts(struct vfsmou
21 release_mounts(&umount_list);
22 }
23
24+struct vfsmount *clone_private_mount(struct path *path)
25+{
26+ struct mount *old_mnt = real_mount(path->mnt);
27+ struct mount *new_mnt;
28+
29+ if (IS_MNT_UNBINDABLE(old_mnt))
30+ return ERR_PTR(-EINVAL);
31+
32+ down_read(&namespace_sem);
33+ new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
34+ up_read(&namespace_sem);
35+ if (!new_mnt)
36+ return ERR_PTR(-ENOMEM);
37+
38+ return &new_mnt->mnt;
39+}
40+EXPORT_SYMBOL_GPL(clone_private_mount);
41+
42 int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
43 struct vfsmount *root)
44 {
45Index: linux-3.6-rc7-master/include/linux/mount.h
46===================================================================
47--- linux-3.6-rc7-master.orig/include/linux/mount.h 2012-09-24 03:10:57.000000000 +0200
48+++ linux-3.6-rc7-master/include/linux/mount.h 2012-09-28 13:36:51.000000000 +0200
49@@ -66,6 +66,9 @@ extern void mnt_pin(struct vfsmount *mnt
50 extern void mnt_unpin(struct vfsmount *mnt);
51 extern int __mnt_is_readonly(struct vfsmount *mnt);
52
53+struct path;
54+extern struct vfsmount *clone_private_mount(struct path *path);
55+
56 struct file_system_type;
57 extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
58 int flags, const char *name,
This page took 0.130497 seconds and 4 git commands to generate.