Helper functions in base.c like proc_pident_readdir and proc_pident_lookup assume the directories have an associated task, and cannot currently be used on the /proc root directory because it does not have such a task. This small changes allows for base.c to be simplified and later when multiple pid spaces are introduced it makes getting the needed context information trivial. Signed-off-by: Eric W. Biederman <[email protected]> --- fs/proc/root.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) 516b38bf721663deded53591272bdfc8f032f885 diff --git a/fs/proc/root.c b/fs/proc/root.c index c3fd361..a3ceff3 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -17,6 +17,7 @@ #include <linux/module.h> #include <linux/bitops.h> #include <linux/smp_lock.h> +#include <linux/mount.h> #include "internal.h" @@ -29,6 +30,18 @@ struct proc_dir_entry *proc_sys_root; static struct super_block *proc_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { + if (proc_mnt) { + /* Seed the root directory with a task so it doesn't need + * to be special in base.c. I would do this earlier but + * the only task alive when /proc is mounted the first time + * is the init_task and it is never considered alive. + */ + struct proc_inode *ei; + ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode); + if (!ei->tref->task) + tref_set(&ei->tref, + tref_get_by_pid(1, PIDTYPE_PID)); + } return get_sb_single(fs_type, flags, data, proc_fill_super); } -- 1.2.2.g709a - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 18/23] proc: Reorder the functions in base.c
- From: [email protected] (Eric W. Biederman)
- [PATCH 18/23] proc: Reorder the functions in base.c
- References:
- [PATCH 00/23] proc cleanup.
- From: [email protected] (Eric W. Biederman)
- [PATCH 01/23] tref: Implement task references.
- From: [email protected] (Eric W. Biederman)
- [PATCH 02/23] proc: Fix the .. inode number on /proc/<pid>/fd
- From: [email protected] (Eric W. Biederman)
- [PATCH 03/23] proc: Remove useless BKL in proc_pid_readlink.
- From: [email protected] (Eric W. Biederman)
- [PATCH 04/23] proc: Remove unnecessary and misleading assignments from proc_pid_make_inode.
- From: [email protected] (Eric W. Biederman)
- [PATCH 05/23] proc: Simplify the ownership rules for /proc
- From: [email protected] (Eric W. Biederman)
- [PATCH 06/23] proc: Replace proc_inode.type with proc_inode.fd
- From: [email protected] (Eric W. Biederman)
- [PATCH 07/23] proc: Remove bogus proc_task_permission.
- From: [email protected] (Eric W. Biederman)
- [PATCH 08/23] proc: Kill proc_mem_inode_operations.
- From: [email protected] (Eric W. Biederman)
- [PATCH 09/23] proc: Properly filter out files that are not visible to a process.
- From: [email protected] (Eric W. Biederman)
- [PATCH 10/23] proc: Fix the link count for /proc/<pid>/task
- From: [email protected] (Eric W. Biederman)
- [PATCH 11/23] proc: Move proc_maps_operations into task_mmu.c
- From: [email protected] (Eric W. Biederman)
- [PATCH 12/23] proc: Rewrite the proc dentry flush on exit optimization.
- From: [email protected] (Eric W. Biederman)
- [PATCH 13/23] proc: Close the race of a process dying durning lookup.
- From: [email protected] (Eric W. Biederman)
- [PATCH 14/23] proc: Make PROC_NUMBUF the buffer size for holding a integers as strings.
- From: [email protected] (Eric W. Biederman)
- [PATCH 15/23] proc: refactor reading directories of tasks.
- From: [email protected] (Eric W. Biederman)
- [PATCH 16/23] proc: Don't lock task_structs indefinitely.
- From: [email protected] (Eric W. Biederman)
- [PATCH 00/23] proc cleanup.
- Prev by Date: [PATCH 16/23] proc: Don't lock task_structs indefinitely.
- Next by Date: CRC errors with sata drives connected to ULi M5281
- Previous by thread: [PATCH 16/23] proc: Don't lock task_structs indefinitely.
- Next by thread: [PATCH 18/23] proc: Reorder the functions in base.c
- Index(es):