mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: viro@ZenIV.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	apw@canonical.com, nbd@openwrt.org, neilb@suse.de
Subject: [PATCH 3/6 v7] vfs: introduce clone_private_mount()
Date: Tue, 22 Mar 2011 16:26:05 +0100	[thread overview]
Message-ID: <20110322153017.290391787@szeredi.hu> (raw)
In-Reply-To: <20110322152602.053930811@szeredi.hu>

[-- Attachment #1: vfs-export-clone_mnt.patch --]
[-- Type: text/plain, Size: 1732 bytes --]

From: Miklos Szeredi <mszeredi@suse.cz>

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>
---
 fs/namespace.c        |   17 +++++++++++++++++
 include/linux/mount.h |    3 +++
 2 files changed, 20 insertions(+)

Index: linux-2.6/fs/namespace.c
===================================================================
--- linux-2.6.orig/fs/namespace.c	2011-03-22 15:11:27.000000000 +0100
+++ linux-2.6/fs/namespace.c	2011-03-22 15:11:34.000000000 +0100
@@ -1510,6 +1510,23 @@ void drop_collected_mounts(struct vfsmou
 	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)
 {
Index: linux-2.6/include/linux/mount.h
===================================================================
--- linux-2.6.orig/include/linux/mount.h	2011-03-22 15:11:27.000000000 +0100
+++ linux-2.6/include/linux/mount.h	2011-03-22 15:11:34.000000000 +0100
@@ -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);
 

-- 

  parent reply	other threads:[~2011-03-22 15:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 15:26 [PATCH 0/6 v7] overlay filesystem - request for inclusion Miklos Szeredi
2011-03-22 15:26 ` [PATCH 1/6 v7] vfs: add i_op->open() Miklos Szeredi
2011-03-22 17:18   ` Linus Torvalds
2011-03-22 18:12     ` Miklos Szeredi
2011-03-22 18:37       ` Linus Torvalds
2011-03-22 15:26 ` [PATCH 2/6 v7] vfs: export do_splice_direct() to modules Miklos Szeredi
2011-03-22 15:26 ` Miklos Szeredi [this message]
2011-03-22 15:26 ` [PATCH 4/6 v7] overlay filesystem prototype Miklos Szeredi
2011-03-22 17:30   ` Linus Torvalds
2011-03-22 18:15     ` Miklos Szeredi
2011-03-22 15:26 ` [PATCH 5/6 v7] overlayfs: add statfs support Miklos Szeredi
2011-03-22 15:26 ` [PATCH 6/6 v7] overlay: overlay filesystem documentation Miklos Szeredi
2011-03-22 17:36 ` [PATCH 0/6 v7] overlay filesystem - request for inclusion Linus Torvalds
2011-03-22 18:22   ` Felix Fietkau
2011-03-22 18:27     ` Linus Torvalds
2011-03-22 18:49     ` Xianghua Xiao
2011-03-22 23:13       ` Hans-Peter Jansen
2011-03-24 15:24         ` J. R. Okajima
2011-03-22 18:39   ` Al Viro
2011-03-22 18:48     ` Linus Torvalds
2011-03-22 18:58       ` Miklos Szeredi
2011-03-22 19:00         ` Al Viro
2011-03-22 19:43           ` Miklos Szeredi
2011-03-22 19:53             ` Al Viro
2011-03-22 20:06               ` Miklos Szeredi
2011-03-22 20:11                 ` Al Viro
2011-03-22 20:31                   ` Miklos Szeredi
2011-03-22 20:40                     ` Miklos Szeredi
2011-03-23 10:03                     ` Miklos Szeredi
2011-03-22 19:38         ` Al Viro
2011-03-22 19:56           ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110322153017.290391787@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=neilb@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®