Skip to content

Commit ae06c7c

Browse files
committed
procfs: Don't cache a pid in the root inode.
Now that we have s_fs_info pointing to our pid namespace the original reason for the proc root inode having a struct pid is gone. Caching a pid in the root inode has led to some complicated code. Now that we don't need the struct pid, just remove it. Signed-off-by: Eric W. Biederman <[email protected]>
1 parent e656d8a commit ae06c7c

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

fs/proc/base.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,19 +2714,12 @@ static int fake_filldir(void *buf, const char *name, int namelen,
27142714
/* for the /proc/ directory itself, after non-process stuff has been done */
27152715
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
27162716
{
2717-
unsigned int nr;
2718-
struct task_struct *reaper;
27192717
struct tgid_iter iter;
27202718
struct pid_namespace *ns;
27212719
filldir_t __filldir;
27222720

27232721
if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET)
2724-
goto out_no_task;
2725-
nr = filp->f_pos - FIRST_PROCESS_ENTRY;
2726-
2727-
reaper = get_proc_task(filp->f_path.dentry->d_inode);
2728-
if (!reaper)
2729-
goto out_no_task;
2722+
goto out;
27302723

27312724
ns = filp->f_dentry->d_sb->s_fs_info;
27322725
iter.task = NULL;
@@ -2747,8 +2740,6 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
27472740
}
27482741
filp->f_pos = PID_MAX_LIMIT + TGID_OFFSET;
27492742
out:
2750-
put_task_struct(reaper);
2751-
out_no_task:
27522743
return 0;
27532744
}
27542745

fs/proc/root.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
100100
int err;
101101
struct super_block *sb;
102102
struct pid_namespace *ns;
103-
struct proc_inode *ei;
104103
char *options;
105104

106105
if (flags & MS_KERNMOUNT) {
@@ -130,13 +129,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
130129
sb->s_flags |= MS_ACTIVE;
131130
}
132131

133-
ei = PROC_I(sb->s_root->d_inode);
134-
if (!ei->pid) {
135-
rcu_read_lock();
136-
ei->pid = get_pid(find_pid_ns(1, ns));
137-
rcu_read_unlock();
138-
}
139-
140132
return dget(sb->s_root);
141133
}
142134

0 commit comments

Comments
 (0)