Skip to content

Commit db96316

Browse files
author
Al Viro
committed
proc_pid_readdir(): stop wanking with proc_fill_cache() for /proc/self
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 147ce69 commit db96316

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/proc/base.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,21 +2882,21 @@ static struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter ite
28822882
int proc_pid_readdir(struct file *file, struct dir_context *ctx)
28832883
{
28842884
struct tgid_iter iter;
2885-
struct pid_namespace *ns;
2885+
struct pid_namespace *ns = file->f_dentry->d_sb->s_fs_info;
28862886
loff_t pos = ctx->pos;
28872887

28882888
if (pos >= PID_MAX_LIMIT + TGID_OFFSET)
28892889
return 0;
28902890

28912891
if (pos == TGID_OFFSET - 1) {
2892-
if (!proc_fill_cache(file, ctx, "self", 4, NULL, NULL, NULL))
2892+
struct inode *inode = ns->proc_self->d_inode;
2893+
if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK))
28932894
return 0;
28942895
iter.tgid = 0;
28952896
} else {
28962897
iter.tgid = pos - TGID_OFFSET;
28972898
}
28982899
iter.task = NULL;
2899-
ns = file->f_dentry->d_sb->s_fs_info;
29002900
for (iter = next_tgid(ns, iter);
29012901
iter.task;
29022902
iter.tgid += 1, iter = next_tgid(ns, iter)) {

0 commit comments

Comments
 (0)