aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorOlaf Kirch <okir@suse.de>2006-10-04 05:15:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:16 -0400
commit977faf392fc898407554bbe7338d57b29e3660cf (patch)
tree9bd611c100e3e2d1aa336010124cda0155183bb8 /fs/lockd
parent7b2b1fee30df7e2165525cd03f7d1d01a3a56794 (diff)
[PATCH] knfsd: hide use of lockd's h_monitored flag
This patch moves all checks of the h_monitored flag into the nsm_monitor/unmonitor functions. A subsequent patch will replace the mechanism by which we mark a host as being monitored. There is still one occurence of h_monitored outside of mon.c and that is in clntlock.c where we respond to a reboot. The subsequent patch will modify this too. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/clntproc.c2
-rw-r--r--fs/lockd/host.c9
-rw-r--r--fs/lockd/mon.c19
-rw-r--r--fs/lockd/svc4proc.c2
-rw-r--r--fs/lockd/svcproc.c2
5 files changed, 21 insertions, 13 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 0116729cec5f..5436be623e30 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -499,7 +499,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
499 unsigned char fl_flags = fl->fl_flags; 499 unsigned char fl_flags = fl->fl_flags;
500 int status = -ENOLCK; 500 int status = -ENOLCK;
501 501
502 if (!host->h_monitored && nsm_monitor(host) < 0) { 502 if (nsm_monitor(host) < 0) {
503 printk(KERN_NOTICE "lockd: failed to monitor %s\n", 503 printk(KERN_NOTICE "lockd: failed to monitor %s\n",
504 host->h_name); 504 host->h_name);
505 goto out; 505 goto out;
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index a0d0b58ce7a4..637ec9567066 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -331,9 +331,12 @@ nlm_gc_hosts(void)
331 } 331 }
332 dprintk("lockd: delete host %s\n", host->h_name); 332 dprintk("lockd: delete host %s\n", host->h_name);
333 *q = host->h_next; 333 *q = host->h_next;
334 /* Don't unmonitor hosts that have been invalidated */ 334
335 if (host->h_monitored && !host->h_killed) 335 /*
336 nsm_unmonitor(host); 336 * Unmonitor unless host was invalidated (i.e. lockd restarted)
337 */
338 nsm_unmonitor(host);
339
337 if ((clnt = host->h_rpcclnt) != NULL) { 340 if ((clnt = host->h_rpcclnt) != NULL) {
338 if (atomic_read(&clnt->cl_users)) { 341 if (atomic_read(&clnt->cl_users)) {
339 printk(KERN_WARNING 342 printk(KERN_WARNING
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index a816b920d431..e02a1a4dfced 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -74,6 +74,8 @@ nsm_monitor(struct nlm_host *host)
74 int status; 74 int status;
75 75
76 dprintk("lockd: nsm_monitor(%s)\n", host->h_name); 76 dprintk("lockd: nsm_monitor(%s)\n", host->h_name);
77 if (host->h_monitored)
78 return 0;
77 79
78 status = nsm_mon_unmon(host, SM_MON, &res); 80 status = nsm_mon_unmon(host, SM_MON, &res);
79 81
@@ -91,15 +93,18 @@ int
91nsm_unmonitor(struct nlm_host *host) 93nsm_unmonitor(struct nlm_host *host)
92{ 94{
93 struct nsm_res res; 95 struct nsm_res res;
94 int status; 96 int status = 0;
95 97
96 dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name); 98 dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name);
97 99 if (!host->h_monitored)
98 status = nsm_mon_unmon(host, SM_UNMON, &res); 100 return 0;
99 if (status < 0) 101 host->h_monitored = 0;
100 printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name); 102
101 else 103 if (!host->h_killed) {
102 host->h_monitored = 0; 104 status = nsm_mon_unmon(host, SM_UNMON, &res);
105 if (status < 0)
106 printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name);
107 }
103 return status; 108 return status;
104} 109}
105 110
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index a2dd9ccb9b32..b5aceb83f8cb 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -39,7 +39,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
39 39
40 /* Obtain host handle */ 40 /* Obtain host handle */
41 if (!(host = nlmsvc_lookup_host(rqstp)) 41 if (!(host = nlmsvc_lookup_host(rqstp))
42 || (argp->monitor && !host->h_monitored && nsm_monitor(host) < 0)) 42 || (argp->monitor && nsm_monitor(host) < 0))
43 goto no_locks; 43 goto no_locks;
44 *hostp = host; 44 *hostp = host;
45 45
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index dbb66a3b5cd9..dbc4ea2638c9 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -67,7 +67,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
67 67
68 /* Obtain host handle */ 68 /* Obtain host handle */
69 if (!(host = nlmsvc_lookup_host(rqstp)) 69 if (!(host = nlmsvc_lookup_host(rqstp))
70 || (argp->monitor && !host->h_monitored && nsm_monitor(host) < 0)) 70 || (argp->monitor && nsm_monitor(host) < 0))
71 goto no_locks; 71 goto no_locks;
72 *hostp = host; 72 *hostp = host;
73 73