Messages in this thread Patch in this message | | | Subject | [PATCH 16/20] nfs: Don't use pids to track the lockd server process. | From | (Eric W. Biederman) | Date | Mon, 06 Feb 2006 13:02:09 -0700 |
| |
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
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/
| |