From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751624AbWBWQZT (ORCPT ); Thu, 23 Feb 2006 11:25:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751677AbWBWQZS (ORCPT ); Thu, 23 Feb 2006 11:25:18 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:25751 "EHLO ebiederm.dsl.xmission.com") by vger.kernel.org with ESMTP id S1751667AbWBWQZQ (ORCPT ); Thu, 23 Feb 2006 11:25:16 -0500 To: Andrew Morton Cc: Subject: [PATCH 17/23] proc: Give the root directory a task. References: From: ebiederm@xmission.com (Eric W. Biederman) Date: Thu, 23 Feb 2006 09:24:08 -0700 In-Reply-To: (Eric W. Biederman's message of "Thu, 23 Feb 2006 09:23:15 -0700") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 #include #include +#include #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