Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae06c7c8 authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

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: default avatarEric W. Biederman <ebiederm@xmission.com>
parent e656d8a6
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -2714,19 +2714,12 @@ static int fake_filldir(void *buf, const char *name, int namelen,
/* for the /proc/ directory itself, after non-process stuff has been done */
/* for the /proc/ directory itself, after non-process stuff has been done */
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
{
	unsigned int nr;
	struct task_struct *reaper;
	struct tgid_iter iter;
	struct tgid_iter iter;
	struct pid_namespace *ns;
	struct pid_namespace *ns;
	filldir_t __filldir;
	filldir_t __filldir;


	if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET)
	if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET)
		goto out_no_task;
		goto out;
	nr = filp->f_pos - FIRST_PROCESS_ENTRY;

	reaper = get_proc_task(filp->f_path.dentry->d_inode);
	if (!reaper)
		goto out_no_task;


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


+0 −8
Original line number Original line Diff line number Diff line
@@ -100,7 +100,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
	int err;
	int err;
	struct super_block *sb;
	struct super_block *sb;
	struct pid_namespace *ns;
	struct pid_namespace *ns;
	struct proc_inode *ei;
	char *options;
	char *options;


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


	ei = PROC_I(sb->s_root->d_inode);
	if (!ei->pid) {
		rcu_read_lock();
		ei->pid = get_pid(find_pid_ns(1, ns));
		rcu_read_unlock();
	}

	return dget(sb->s_root);
	return dget(sb->s_root);
}
}