mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: apw@canonical.com
Subject: [PATCH 3/6 v6] vfs: introduce clone_private_mount()
Date: Tue, 01 Mar 2011 13:36:48 +0100	[thread overview]
Message-ID: <20110301123703.554379304@szeredi.hu> (raw)
In-Reply-To: <20110301123645.189703316@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-01 12:17:47.000000000 +0100
+++ linux-2.6/fs/namespace.c	2011-03-01 12:18:18.000000000 +0100
@@ -1451,6 +1451,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-01 12:17:47.000000000 +0100
+++ linux-2.6/include/linux/mount.h	2011-03-01 12:18:18.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-01 12:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 12:36 [PATCH 0/6 v6] overlay filesystem prototype Miklos Szeredi
2011-03-01 12:36 ` [PATCH 1/6 v6] vfs: add i_op->open() Miklos Szeredi
2011-03-01 12:36 ` [PATCH 2/6 v6] vfs: export do_splice_direct() to modules Miklos Szeredi
2011-03-01 15:49   ` richard -rw- weinberger
2011-03-02 12:43     ` Miklos Szeredi
2011-03-01 12:36 ` Miklos Szeredi [this message]
2011-03-01 12:36 ` [PATCH 4/6 v6] overlay filesystem prototype Miklos Szeredi
2011-03-01 12:36 ` [PATCH 5/6 v6] overlayfs: add statfs support Miklos Szeredi
2011-03-01 12:36 ` [PATCH 6/6 v6] overlay: overlay filesystem documentation Miklos Szeredi
2011-03-01 18:25   ` Randy Dunlap
2011-03-02 13:37     ` 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=20110301123703.554379304@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=apw@canonical.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®