All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: Sukadev Bhattiprolu
	<sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>,
	Oleg Nesterov <oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>,
	Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Dave Hansen <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [PATCH 4/15] Make proc_flust_task() flush entries from multiple proc trees
Date: Thu, 26 Jul 2007 18:48:59 +0400	[thread overview]
Message-ID: <46A8B45B.70202@openvz.org> (raw)
In-Reply-To: <46A8B37B.6050108-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>

Since a task will appear in more than one proc tree we need to shrink many
trees. For this case we pass the struct pid to proc_flush_task() and shrink
the mounts of all the namespaces this pid belongs to.

The NULL passed to it means that only global mount is to be flushed.
This is a preparation for a real flushing patch.

Signed-off-by: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>

---

 fs/proc/base.c          |   18 +++++++++++++++---
 include/linux/proc_fs.h |    6 ++++--
 kernel/exit.c           |    2 +-
 3 files changed, 20 insertions(+), 6 deletions(-)

diff -upr linux-2.6.23-rc1-mm1.orig/fs/proc/base.c linux-2.6.23-rc1-mm1-7/fs/proc/base.c
--- linux-2.6.23-rc1-mm1.orig/fs/proc/base.c	2007-07-26 16:34:45.000000000 +0400
+++ linux-2.6.23-rc1-mm1-7/fs/proc/base.c	2007-07-26 16:36:37.000000000 +0400
@@ -74,6 +74,7 @@
 #include <linux/nsproxy.h>
 #include <linux/oom.h>
 #include <linux/elf.h>
+#include <linux/pid_namespace.h>
 #include "internal.h"
 
 /* NOTE:
@@ -2115,7 +2116,7 @@ static const struct inode_operations pro
  *       that no dcache entries will exist at process exit time it
  *       just makes it very unlikely that any will persist.
  */
-void proc_flush_task(struct task_struct *task)
+static void proc_flush_task_mnt(struct task_struct *task, struct vfsmount *mnt)
 {
 	struct dentry *dentry, *leader, *dir;
 	char buf[PROC_NUMBUF];
@@ -2123,7 +2124,7 @@ void proc_flush_task(struct task_struct 
 
 	name.name = buf;
 	name.len = snprintf(buf, sizeof(buf), "%d", task->pid);
-	dentry = d_hash_and_lookup(proc_mnt->mnt_root, &name);
+	dentry = d_hash_and_lookup(mnt->mnt_root, &name);
 	if (dentry) {
 		shrink_dcache_parent(dentry);
 		d_drop(dentry);
@@ -2135,7 +2136,7 @@ void proc_flush_task(struct task_struct 
 
 	name.name = buf;
 	name.len = snprintf(buf, sizeof(buf), "%d", task->tgid);
-	leader = d_hash_and_lookup(proc_mnt->mnt_root, &name);
+	leader = d_hash_and_lookup(mnt->mnt_root, &name);
 	if (!leader)
 		goto out;
 
@@ -2161,6 +2162,17 @@ out:
 	return;
 }
 
+/*
+ * when flushing dentries from proc one need to flush them from global
+ * proc (proc_mnt) and from all the namespaces' procs this task was seen
+ * in. this call is supposed to make all this job.
+ */
+
+void proc_flush_task(struct task_struct *task, struct pid *pid)
+{
+	proc_flush_task_mnt(task, proc_mnt);
+}
+
 static struct dentry *proc_pid_instantiate(struct inode *dir,
 					   struct dentry * dentry,
 					   struct task_struct *task, const void *ptr)
diff -upr linux-2.6.23-rc1-mm1.orig/include/linux/proc_fs.h linux-2.6.23-rc1-mm1-7/include/linux/proc_fs.h
--- linux-2.6.23-rc1-mm1.orig/include/linux/proc_fs.h	2007-07-26 16:34:45.000000000 +0400
+++ linux-2.6.23-rc1-mm1-7/include/linux/proc_fs.h	2007-07-26 16:36:36.000000000 +0400
@@ -111,7 +111,7 @@ extern void proc_misc_init(void);
 
 struct mm_struct;
 
-void proc_flush_task(struct task_struct *task);
+void proc_flush_task(struct task_struct *task, struct pid *pid);
 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
 unsigned long task_vsize(struct mm_struct *);
@@ -223,7 +227,9 @@ static inline void proc_net_remove(const
 #define proc_net_create(name, mode, info)	({ (void)(mode), NULL; })
 static inline void proc_net_remove(const char *name) {}
 
-static inline void proc_flush_task(struct task_struct *task) { }
+static inline void proc_flush_task(struct task_struct *task, struct pid *pid)
+{
+}
 
 static inline struct proc_dir_entry *create_proc_entry(const char *name,
 	mode_t mode, struct proc_dir_entry *parent) { return NULL; }
diff -upr linux-2.6.23-rc1-mm1.orig/kernel/exit.c linux-2.6.23-rc1-mm1-7/kernel/exit.c
--- linux-2.6.23-rc1-mm1.orig/kernel/exit.c	2007-07-26 16:34:45.000000000 +0400
+++ linux-2.6.23-rc1-mm1-7/kernel/exit.c	2007-07-26 16:36:37.000000000 +0400
@@ -184,7 +199,7 @@ repeat:
 	}
 
 	write_unlock_irq(&tasklist_lock);
-	proc_flush_task(p);
+	proc_flush_task(p, NULL);
 	release_thread(p);
 	call_rcu(&p->rcu, delayed_put_task_struct);

  parent reply	other threads:[~2007-07-26 14:48 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 14:45 [RFC][PATCH 0/15] Pid namespaces Pavel Emelyanov
     [not found] ` <46A8B37B.6050108-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-26 14:46   ` [PATCH 1/15] Move exit_task_namespaces() Pavel Emelyanov
     [not found]     ` <46A8B3C4.5080601-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-26 16:10       ` Dave Hansen
2007-07-27  6:38         ` Pavel Emelyanov
2007-07-26 16:47       ` Oleg Nesterov
     [not found]         ` <20070726164724.GA81-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-26 16:59           ` Kirill Korotaev
2007-07-27  8:07           ` Oleg Nesterov
     [not found]             ` <20070727080758.GA509-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-27  8:24               ` Pavel Emelyanov
     [not found]                 ` <46A9ABC1.1000800-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27  8:35                   ` Oleg Nesterov
     [not found]                     ` <20070727083541.GA528-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-27  8:37                       ` Pavel Emelyanov
2007-08-02 16:20       ` Oleg Nesterov
     [not found]         ` <20070802162023.GB137-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-06  8:00           ` Pavel Emelyanov
     [not found]             ` <46B6D52C.3010405-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-06  9:54               ` Oleg Nesterov
     [not found]                 ` <20070806095421.GA85-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-06  9:58                   ` Pavel Emelyanov
     [not found]                     ` <46B6F0DA.4080904-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-06 10:38                       ` Oleg Nesterov
     [not found]                         ` <20070806103838.GA129-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-06 11:21                           ` Pavel Emelyanov
     [not found]                             ` <46B7044A.4030508-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-06 12:54                               ` Oleg Nesterov
     [not found]                                 ` <20070806125419.GB91-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-06 13:38                                   ` Pavel Emelyanov
2007-08-06 11:29                           ` Pavel Emelyanov
     [not found]                             ` <46B7060E.3020609-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-06 12:50                               ` Oleg Nesterov
     [not found]                                 ` <20070806125032.GA91-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-06 13:36                                   ` Pavel Emelyanov
     [not found]                                     ` <46B723F3.8020905-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-06 13:57                                       ` Oleg Nesterov
2007-07-26 14:47   ` [PATCH 2/15] Introduce MS_KERNMOUNT flag Pavel Emelyanov
2007-07-26 14:48   ` [PATCH 3/15] kern_siginfo helper Pavel Emelyanov
     [not found]     ` <46A8B42F.5070605-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-29 11:41       ` Oleg Nesterov
     [not found]         ` <20070729114154.GE120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:07           ` Pavel Emelyanov
     [not found]             ` <46AD8032.90005-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-31  0:21               ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2007-07-26 14:48   ` Pavel Emelyanov [this message]
2007-07-26 14:49   ` [PATCH 5/15] Introduce struct upid Pavel Emelyanov
     [not found]     ` <46A8B486.3030006-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-29  9:52       ` Oleg Nesterov
     [not found]         ` <20070729095210.GA120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  5:58           ` Pavel Emelyanov
2007-07-26 14:50   ` [PATCH 6/15] Make alloc_pid(), free_pid() and put_pid() work with " Pavel Emelyanov
     [not found]     ` <46A8B4AE.6040903-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-29 10:16       ` Oleg Nesterov
     [not found]         ` <20070729101651.GB120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:03           ` Pavel Emelyanov
2007-07-26 14:51   ` [PATCH 7/15] Helpers to obtain pid numbers Pavel Emelyanov
     [not found]     ` <46A8B4D6.1080301-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-26 19:03       ` Dave Hansen
2007-07-27  6:40         ` Pavel Emelyanov
2007-07-29 12:10       ` Oleg Nesterov
     [not found]         ` <20070729121051.GF120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:11           ` Pavel Emelyanov
2007-07-26 14:51   ` [PATCH 8/15] Helpers to find the task by its numerical ids Pavel Emelyanov
     [not found]     ` <46A8B502.8070606-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-26 19:05       ` Dave Hansen
2007-07-27  6:43         ` Pavel Emelyanov
2007-07-29 12:40       ` Oleg Nesterov
     [not found]         ` <20070729124045.GG120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:15           ` Pavel Emelyanov
2007-07-26 14:52   ` [PATCH 9/15] Move alloc_pid() after the namespace is cloned Pavel Emelyanov
     [not found]     ` <46A8B531.3050602-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27 15:12       ` Oleg Nesterov
     [not found]         ` <20070727151238.GA336-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:17           ` Pavel Emelyanov
     [not found]             ` <46AD8266.8050802-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-30 23:43               ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2007-07-31  5:49       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2007-07-26 14:54   ` [PATCH 10/15] Make each namespace has its own proc tree Pavel Emelyanov
     [not found]     ` <46A8B59E.7050009-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-26 17:38       ` Dave Hansen
2007-07-29 15:58       ` Oleg Nesterov
     [not found]         ` <20070729155841.GI120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-29 17:04           ` Oleg Nesterov
     [not found]             ` <20070729170436.GA941-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:45               ` Pavel Emelyanov
2007-07-30  6:43           ` Pavel Emelyanov
2007-07-26 14:55   ` [PATCH 11/15] Signal semantics Pavel Emelyanov
     [not found]     ` <46A8B5C7.9040407-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27 12:31       ` Oleg Nesterov
     [not found]         ` <20070727123153.GA92-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-27 13:38           ` Pavel Emelyanov
     [not found]             ` <46A9F54B.5050000-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27 18:46               ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                 ` <20070727184604.GB1072-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-27 19:59                   ` Serge E. Hallyn
     [not found]                     ` <20070727195943.GA25878-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-07-27 20:23                       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                         ` <20070727202337.GC1072-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-30  9:34                           ` Pavel Emelyanov
2007-07-30  9:31                       ` Pavel Emelyanov
     [not found]                         ` <46ADB000.1000705-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-01 16:13                           ` Serge E. Hallyn
     [not found]                             ` <20070801161335.GA10747-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-08-02  8:35                               ` Kirill Korotaev
     [not found]                                 ` <46B19754.4050908-3ImXcnM4P+0@public.gmane.org>
2007-08-02 20:09                                   ` Serge E. Hallyn
2007-07-29 11:25                   ` Oleg Nesterov
2007-07-26 14:56   ` [PATCH 12/15] Miscelaneous stuff for pid namespaces Pavel Emelyanov
     [not found]     ` <46A8B601.4020108-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27  6:22       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]         ` <20070727062213.GE23584-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-27  6:53           ` Pavel Emelyanov
2007-07-26 14:56   ` [PATCH 13/15] Clone the pid namespace Pavel Emelyanov
2007-07-26 14:57   ` [PATCH 14/15] Destroy pid namespace on init's death Pavel Emelyanov
     [not found]     ` <46A8B663.9040206-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-29 10:41       ` Oleg Nesterov
     [not found]         ` <20070729104145.GC120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30 11:56           ` Pavel Emelyanov
     [not found]             ` <46ADD202.9030502-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-30 15:46               ` Oleg Nesterov
     [not found]                 ` <20070730154639.GA127-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-31  6:19                   ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                     ` <20070731061917.GB17013-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-31  9:07                       ` Oleg Nesterov
     [not found]                         ` <20070731090721.GA110-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-01  6:16                           ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                             ` <20070801061616.GA5405-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-08-01 16:00                               ` Dave Hansen
2007-08-01 19:51                                 ` Oleg Nesterov
     [not found]                                   ` <20070801195123.GB196-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02  8:37                                     ` Kirill Korotaev
     [not found]                                       ` <46B197E3.3040309-3ImXcnM4P+0@public.gmane.org>
2007-08-02 16:08                                         ` Oleg Nesterov
     [not found]                                           ` <20070802160851.GA137-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02 17:08                                             ` Oleg Nesterov
     [not found]                                               ` <20070802170820.GA2566-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-03  6:22                                                 ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                                                   ` <20070803062227.GA16833-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-08-03 10:55                                                     ` Oleg Nesterov
     [not found]                                                       ` <20070803105557.GA91-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-03 21:36                                                         ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2007-08-02  7:37                                 ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2007-08-01 19:48                               ` Oleg Nesterov
     [not found]                                 ` <20070801194811.GA196-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02  7:29                                   ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                                     ` <20070802072958.GA729-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-08-02 15:40                                       ` Oleg Nesterov
     [not found]                                         ` <20070802154018.GA93-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02 17:20                                           ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                                             ` <20070802172033.GA8011-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-08-02 17:31                                               ` Oleg Nesterov
     [not found]                                                 ` <20070802173128.GA2616-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02 18:36                                                   ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                                                     ` <20070802183608.GB15332-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-08-02 18:49                                                       ` Oleg Nesterov
     [not found]                                                         ` <20070802184953.GA316-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-02 19:13                                                           ` Serge E. Hallyn
2007-07-26 14:58   ` [PATCH 15/15] Hooks over the code to show correct values to user Pavel Emelyanov
     [not found]     ` <46A8B6AD.4000307-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-27  5:57       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]         ` <20070727055736.GC23584-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-27  6:44           ` Pavel Emelyanov
2007-07-29 14:31       ` Oleg Nesterov
     [not found]         ` <20070729143136.GH120-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-07-30  6:49           ` Pavel Emelyanov
     [not found]             ` <46AD89E6.1030607-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-07-31 10:04               ` Oleg Nesterov
2007-07-27  4:22   ` [RFC][PATCH 0/15] Pid namespaces sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20070727042213.GB23584-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-27  6:08       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]         ` <20070727060856.GD23584-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-27  6:47           ` Pavel Emelyanov

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=46A8B45B.70202@openvz.org \
    --to=xemul-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org \
    --cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.