aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-29 19:27:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:05 -0400
commit021ada7dff22d0d9540ff596cb0f8bb866755ee1 (patch)
tree3f8a8a8c4ab35ff7cf3f968c079b855a1a18377c /fs/proc/base.c
parent0ecc833bac594099505a090cbca6ccd5b83d5975 (diff)
procfs: switch /proc/self away from proc_dir_entry
Just have it pinned in dcache all along and let procfs ->kill_sb() drop it before kill_anon_super(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 69078c7cef1f..593e7c5ddb49 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2794,7 +2794,7 @@ retry:
2794 return iter; 2794 return iter;
2795} 2795}
2796 2796
2797#define TGID_OFFSET (FIRST_PROCESS_ENTRY) 2797#define TGID_OFFSET (FIRST_PROCESS_ENTRY + 1)
2798 2798
2799static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 2799static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
2800 struct tgid_iter iter) 2800 struct tgid_iter iter)
@@ -2817,13 +2817,21 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2817 struct tgid_iter iter; 2817 struct tgid_iter iter;
2818 struct pid_namespace *ns; 2818 struct pid_namespace *ns;
2819 filldir_t __filldir; 2819 filldir_t __filldir;
2820 loff_t pos = filp->f_pos;
2820 2821
2821 if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET) 2822 if (pos >= PID_MAX_LIMIT + TGID_OFFSET)
2822 goto out; 2823 goto out;
2823 2824
2824 ns = filp->f_dentry->d_sb->s_fs_info; 2825 if (pos == TGID_OFFSET - 1) {
2826 if (proc_fill_cache(filp, dirent, filldir, "self", 4,
2827 NULL, NULL, NULL) < 0)
2828 goto out;
2829 iter.tgid = 0;
2830 } else {
2831 iter.tgid = pos - TGID_OFFSET;
2832 }
2825 iter.task = NULL; 2833 iter.task = NULL;
2826 iter.tgid = filp->f_pos - TGID_OFFSET; 2834 ns = filp->f_dentry->d_sb->s_fs_info;
2827 for (iter = next_tgid(ns, iter); 2835 for (iter = next_tgid(ns, iter);
2828 iter.task; 2836 iter.task;
2829 iter.tgid += 1, iter = next_tgid(ns, iter)) { 2837 iter.tgid += 1, iter = next_tgid(ns, iter)) {