diff options
author | Olaf Kirch <okir@suse.de> | 2006-10-04 05:15:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:16 -0400 |
commit | 8dead0dbd478f35fd943f3719591e5af1ac0950d (patch) | |
tree | 05ad7dd248263cbeecc4f3d0b4cbb3ec06c65626 /fs/lockd/mon.c | |
parent | db4e4c9a9e741ee812e1febf5e386d6a24218a71 (diff) |
[PATCH] knfsd: lockd: introduce nsm_handle
This patch introduces the nsm_handle, which is shared by all nlm_host objects
referring to the same client.
With this patch applied, all nlm_hosts from the same address will share the
same nsm_handle. A future patch will add sharing by name.
Note: this patch changes h_name so that it is no longer guaranteed to be an IP
address of the host. When the host represents an NFS server, h_name will be
the name passed in the mount call. When the host represents a client, h_name
will be the name presented in the lock request received from the client. A
h_name is only used for printing informational messages, this change should
not be significant.
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/mon.c')
-rw-r--r-- | fs/lockd/mon.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index e02a1a4dfced..e27981403fbe 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -70,11 +70,14 @@ nsm_mon_unmon(struct nlm_host *host, u32 proc, struct nsm_res *res) | |||
70 | int | 70 | int |
71 | nsm_monitor(struct nlm_host *host) | 71 | nsm_monitor(struct nlm_host *host) |
72 | { | 72 | { |
73 | struct nsm_handle *nsm = host->h_nsmhandle; | ||
73 | struct nsm_res res; | 74 | struct nsm_res res; |
74 | int status; | 75 | int status; |
75 | 76 | ||
76 | dprintk("lockd: nsm_monitor(%s)\n", host->h_name); | 77 | dprintk("lockd: nsm_monitor(%s)\n", host->h_name); |
77 | if (host->h_monitored) | 78 | BUG_ON(nsm == NULL); |
79 | |||
80 | if (nsm->sm_monitored) | ||
78 | return 0; | 81 | return 0; |
79 | 82 | ||
80 | status = nsm_mon_unmon(host, SM_MON, &res); | 83 | status = nsm_mon_unmon(host, SM_MON, &res); |
@@ -82,7 +85,7 @@ nsm_monitor(struct nlm_host *host) | |||
82 | if (status < 0 || res.status != 0) | 85 | if (status < 0 || res.status != 0) |
83 | printk(KERN_NOTICE "lockd: cannot monitor %s\n", host->h_name); | 86 | printk(KERN_NOTICE "lockd: cannot monitor %s\n", host->h_name); |
84 | else | 87 | else |
85 | host->h_monitored = 1; | 88 | nsm->sm_monitored = 1; |
86 | return status; | 89 | return status; |
87 | } | 90 | } |
88 | 91 | ||
@@ -92,19 +95,22 @@ nsm_monitor(struct nlm_host *host) | |||
92 | int | 95 | int |
93 | nsm_unmonitor(struct nlm_host *host) | 96 | nsm_unmonitor(struct nlm_host *host) |
94 | { | 97 | { |
98 | struct nsm_handle *nsm = host->h_nsmhandle; | ||
95 | struct nsm_res res; | 99 | struct nsm_res res; |
96 | int status = 0; | 100 | int status = 0; |
97 | 101 | ||
98 | dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name); | 102 | dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name); |
99 | if (!host->h_monitored) | 103 | if (nsm == NULL) |
100 | return 0; | 104 | return 0; |
101 | host->h_monitored = 0; | 105 | host->h_nsmhandle = NULL; |
102 | 106 | ||
103 | if (!host->h_killed) { | 107 | if (!host->h_killed) { |
104 | status = nsm_mon_unmon(host, SM_UNMON, &res); | 108 | status = nsm_mon_unmon(host, SM_UNMON, &res); |
105 | if (status < 0) | 109 | if (status < 0) |
106 | printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name); | 110 | printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name); |
111 | nsm->sm_monitored = 0; | ||
107 | } | 112 | } |
113 | nsm_release(nsm); | ||
108 | return status; | 114 | return status; |
109 | } | 115 | } |
110 | 116 | ||