public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain.net>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>
Subject: [Fwd: [PATCH 3/5] NFS: Abstract out namespace initialisation [try #2]]
Date: Thu, 02 Mar 2006 10:37:03 +1300	[thread overview]
Message-ID: <440613FF.4040807@vilain.net> (raw)

The attached patch abstracts out the namespace initialisation so that 
temporary namespaces can be set up elsewhere.

Signed-Off-By: David Howells <dhowells@redhat.com>
Acked-By: Sam Vilain <sam.vilain@catalyst.net.nz>
---
David,

This looks sane to me, thought I'd just quickly ack it as I'm also doing 
work in this area... it seems a lot of what you're doing is cleaning up 
the boundaries between VFS and FS - did you get a chance to review the 
patch Herbert Pötzl sent to the list about the permission() cleanup?

  fs/namespace.c            |    8 +-------
  include/linux/namespace.h |   15 +++++++++++++++
  2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 51d3ebc..0194538 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1688,13 +1688,7 @@ static void __init init_mount_tree(void)
  	namespace = kmalloc(sizeof(*namespace), GFP_KERNEL);
  	if (!namespace)
  		panic("Can't allocate initial namespace");
-	atomic_set(&namespace->count, 1);
-	INIT_LIST_HEAD(&namespace->list);
-	init_waitqueue_head(&namespace->poll);
-	namespace->event = 0;
-	list_add(&mnt->mnt_list, &namespace->list);
-	namespace->root = mnt;
-	mnt->mnt_namespace = namespace;
+	init_namespace(namespace, mnt);

  	init_task.namespace = namespace;
  	read_lock(&tasklist_lock);
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 3abc8e3..ea6fd62 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -17,6 +17,21 @@ extern int copy_namespace(int, struct ta
  extern void __put_namespace(struct namespace *namespace);
  extern struct namespace *dup_namespace(struct task_struct *, struct 
fs_struct *);

+static inline void init_namespace(struct namespace *namespace,
+				  struct vfsmount *mnt)
+{
+	atomic_set(&namespace->count, 1);
+	INIT_LIST_HEAD(&namespace->list);
+	init_waitqueue_head(&namespace->poll);
+	namespace->event = 0;
+	namespace->root = mnt;
+
+	if (mnt) {
+		list_add(&mnt->mnt_list, &namespace->list);
+		mnt->mnt_namespace = namespace;
+	}
+}
+
  static inline void put_namespace(struct namespace *namespace)
  {
  	if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))


             reply	other threads:[~2006-03-01 21:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01 21:37 Sam Vilain [this message]
2006-03-02  8:44 ` [Fwd: [PATCH 3/5] NFS: Abstract out namespace initialisation [try #2]] Christoph Hellwig
2006-03-02 11:35   ` David Howells
2006-03-02 19:52     ` Sam Vilain
2006-03-02 21:12       ` David Howells
2006-03-02 21:53         ` Sam Vilain
2006-03-05  0:34           ` Andrew Morton
2006-03-03 16:52         ` J. Bruce Fields
2006-03-02 20:00 ` Sam Vilain

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=440613FF.4040807@vilain.net \
    --to=sam@vilain.net \
    --cc=dhowells@redhat.com \
    --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