From e1173df4191b26d21594b29fe4fde9d8fa309195 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 23 Dec 2008 15:21:33 -0500 Subject: [PATCH] --- yaml --- r: 124707 b: refs/heads/master c: df94f000c46c055cf439f5b92807cd827557ffbc h: refs/heads/master i: 124705: 274080179fbd3aa12df255c534b2fdde00c3a01c 124703: c0e1b46948cedf7cc2cada062a05eb3802f2f68d v: v3 --- [refs] | 2 +- trunk/fs/lockd/clntlock.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 7077c43d797a..6f07accce4cb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2de59872a7842143f4507832e7c1f5123c47feb7 +refs/heads/master: df94f000c46c055cf439f5b92807cd827557ffbc diff --git a/trunk/fs/lockd/clntlock.c b/trunk/fs/lockd/clntlock.c index 8307dd64bf46..94d42cc4e393 100644 --- a/trunk/fs/lockd/clntlock.c +++ b/trunk/fs/lockd/clntlock.c @@ -14,6 +14,7 @@ #include #include #include +#include #define NLMDBG_FACILITY NLMDBG_CLIENT @@ -191,11 +192,15 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock) void nlmclnt_recovery(struct nlm_host *host) { + struct task_struct *task; + if (!host->h_reclaiming++) { nlm_get_host(host); - __module_get(THIS_MODULE); - if (kernel_thread(reclaimer, host, CLONE_FS | CLONE_FILES) < 0) - module_put(THIS_MODULE); + task = kthread_run(reclaimer, host, "%s-reclaim", host->h_name); + if (IS_ERR(task)) + printk(KERN_ERR "lockd: unable to spawn reclaimer " + "thread. Locks for %s won't be reclaimed! " + "(%ld)\n", host->h_name, PTR_ERR(task)); } } @@ -207,7 +212,6 @@ reclaimer(void *ptr) struct file_lock *fl, *next; u32 nsmstate; - daemonize("%s-reclaim", host->h_name); allow_signal(SIGKILL); down_write(&host->h_rwsem); @@ -233,7 +237,12 @@ reclaimer(void *ptr) list_for_each_entry_safe(fl, next, &host->h_reclaim, fl_u.nfs_fl.list) { list_del_init(&fl->fl_u.nfs_fl.list); - /* Why are we leaking memory here? --okir */ + /* + * sending this thread a SIGKILL will result in any unreclaimed + * locks being removed from the h_granted list. This means that + * the kernel will not attempt to reclaim them again if a new + * reclaimer thread is spawned for this host. + */ if (signalled()) continue; if (nlmclnt_reclaim(host, fl) != 0) @@ -261,5 +270,5 @@ reclaimer(void *ptr) nlm_release_host(host); lockd_down(); unlock_kernel(); - module_put_and_exit(0); + return 0; }