[RFC][PATCH 2/4] remove proc_mnt's use or killing inodes

Dave Hansen hansendc at us.ibm.com
Fri Jan 26 14:42:10 PST 2007


We use proc_mnt as a shortcut to find a superblock on which
to go killing /proc inodes.  This will break if we ever have
more than one /proc superblock.  So, use the superblock list
to go find each of the /proc sb's and kill inodes on each
superblock.

This eliminates one more use of proc_mnt.

---

 lxc-dave/fs/proc/generic.c |   28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff -puN fs/proc/generic.c~A1-remove-proc_mnt-0 fs/proc/generic.c
--- lxc/fs/proc/generic.c~A1-remove-proc_mnt-0	2007-01-26 14:29:17.000000000 -0800
+++ lxc-dave/fs/proc/generic.c	2007-01-26 14:29:17.000000000 -0800
@@ -547,13 +547,10 @@ static int proc_register(struct proc_dir
 	return 0;
 }
 
-/*
- * Kill an inode that got unregistered..
- */
-static void proc_kill_inodes(struct proc_dir_entry *de)
+static void proc_kill_inodes_sb(struct proc_dir_entry *de,
+				struct super_block *sb)
 {
 	struct list_head *p;
-	struct super_block *sb = proc_mnt->mnt_sb;
 
 	/*
 	 * Actually it's a partial revoke().
@@ -577,6 +574,27 @@ static void proc_kill_inodes(struct proc
 	file_list_unlock();
 }
 
+/*
+ * Kill an inode that got unregistered..
+ */
+static void proc_kill_inodes(struct proc_dir_entry *de)
+{
+	struct list_head *l;
+	struct file_system_type *procfs;
+
+	procfs = get_fs_type("proc");
+	if (!procfs)
+		return;
+
+	spin_lock(&sb_lock);
+	list_for_each(l, &procfs->fs_supers) {
+		struct super_block *sb;
+		sb = list_entry(l, struct super_block, s_instances);
+		proc_kill_inodes_sb(de, sb);
+	}
+	spin_unlock(&sb_lock);
+}
+
 static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
 					  const char *name,
 					  mode_t mode,
_



More information about the Containers mailing list