From: "Eric W. Biederman" Signed-off-by: Eric W. Biederman Cc: Oleg Nesterov Signed-off-by: Andrew Morton --- fs/proc/base.c | 12 ++++++++++++ 1 files changed, 12 insertions(+) diff -puN fs/proc/base.c~proc-comment-what-proc_fill_cache-does fs/proc/base.c --- a/fs/proc/base.c~proc-comment-what-proc_fill_cache-does +++ a/fs/proc/base.c @@ -1057,6 +1057,18 @@ static struct dentry_operations pid_dent typedef struct dentry *instantiate_t(struct inode *, struct dentry *, struct task_struct *, void *); +/* + * Fill a directory entry. + * + * If possible create the dcache entry and derive our inode number and + * file type from dcache entry. + * + * Since all of the proc inode numbers are dynamically generated, the inode + * numbers do not exist until the inode is cache. This means creating the + * the dcache entry in readdir is necessary to keep the inode numbers + * reported by readdir in sync with the inode numbers reported + * by stat. + */ static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir, char *name, int len, instantiate_t instantiate, struct task_struct *task, void *ptr) _