Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932356AbWBFUFL (ORCPT ); Mon, 6 Feb 2006 15:05:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932361AbWBFUFK (ORCPT ); Mon, 6 Feb 2006 15:05:10 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:35200 "EHLO ebiederm.dsl.xmission.com") by vger.kernel.org with ESMTP id S932356AbWBFUEx (ORCPT ); Mon, 6 Feb 2006 15:04:53 -0500 To: ebiederm@xmission.com (Eric W. Biederman) Cc: , , Herbert Poetzl , "Serge E. Hallyn" , Alan Cox , Dave Hansen , Arjan van de Ven , Suleiman Souhlal , Hubertus Franke , Cedric Le Goater , Kyle Moffett , Kirill Korotaev , Greg , Linus Torvalds , Andrew Morton , Greg KH , Rik van Riel , Alexey Kuznetsov , Andrey Savochkin , Kirill Korotaev , Andi Kleen , Benjamin Herrenschmidt , Jeff Garzik , Trond Myklebust , Jes Sorensen Subject: [PATCH 16/20] nfs: Don't use pids to track the lockd server process. References: From: ebiederm@xmission.com (Eric W. Biederman) Date: Mon, 06 Feb 2006 13:02:09 -0700 In-Reply-To: (Eric W. Biederman's message of "Mon, 06 Feb 2006 13:00:47 -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 Content-Length: 3082 Lines: 108 Signed-off-by: Eric W. Biederman --- fs/lockd/svc.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) 8879803b195822f0a4e6f1b05297f5ffe3f62ad1 diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 71a30b4..e5c1d5c 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -45,7 +45,7 @@ EXPORT_SYMBOL(nlmsvc_ops); static DECLARE_MUTEX(nlmsvc_sema); static unsigned int nlmsvc_users; -static pid_t nlmsvc_pid; +static struct task_struct * nlmsvc_task; int nlmsvc_grace_period; unsigned long nlmsvc_timeout; @@ -111,7 +111,8 @@ lockd(struct svc_rqst *rqstp) /* * Let our maker know we're running. */ - nlmsvc_pid = current->pid; + get_task_struct(current); + nlmsvc_task = current; up(&lockd_start); daemonize("lockd"); @@ -135,7 +136,7 @@ lockd(struct svc_rqst *rqstp) * NFS mount or NFS daemon has gone away, and we've been sent a * signal, or else another process has taken over our job. */ - while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) { + while ((nlmsvc_users || !signalled()) && nlmsvc_task == current) { long timeout = MAX_SCHEDULE_TIMEOUT; if (signalled()) { @@ -184,11 +185,12 @@ lockd(struct svc_rqst *rqstp) * Check whether there's a new lockd process before * shutting down the hosts and clearing the slot. */ - if (!nlmsvc_pid || current->pid == nlmsvc_pid) { + if (!nlmsvc_task || current == nlmsvc_task) { if (nlmsvc_ops) nlmsvc_invalidate_all(); nlm_shutdown_hosts(); - nlmsvc_pid = 0; + put_task_struct(nlmsvc_task); + nlmsvc_task = NULL; } else printk(KERN_DEBUG "lockd: new process, skipping host shutdown\n"); @@ -224,7 +226,7 @@ lockd_up(void) /* * Check whether we're already up and running. */ - if (nlmsvc_pid) + if (nlmsvc_task) goto out; /* @@ -290,26 +292,27 @@ lockd_down(void) if (--nlmsvc_users) goto out; } else - printk(KERN_WARNING "lockd_down: no users! pid=%d\n", nlmsvc_pid); + printk(KERN_WARNING "lockd_down: no users! pid=%d\n", nlmsvc_task->pid); - if (!nlmsvc_pid) { + if (!nlmsvc_task) { if (warned++ == 0) printk(KERN_WARNING "lockd_down: no lockd running.\n"); goto out; } warned = 0; - kill_proc(nlmsvc_pid, SIGKILL, 1); + send_group_sig_info(SIGKILL, SEND_SIG_PRIV, nlmsvc_task); /* * Wait for the lockd process to exit, but since we're holding * the lockd semaphore, we can't wait around forever ... */ clear_thread_flag(TIF_SIGPENDING); interruptible_sleep_on_timeout(&lockd_exit, HZ); - if (nlmsvc_pid) { + if (nlmsvc_task) { printk(KERN_WARNING "lockd_down: lockd failed to exit, clearing pid\n"); - nlmsvc_pid = 0; + put_task_struct(nlmsvc_task); + nlmsvc_task = NULL; } spin_lock_irq(¤t->sighand->siglock); recalc_sigpending(); -- 1.1.5.g3480 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/