diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
commit | 46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch) | |
tree | 3b9b51fc482e729f663d25333e77fbed9aaa939a /fs/lockd/mon.c | |
parent | 31dc59d503a02e84c4de98826452acaeb56dc15a (diff) |
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'fs/lockd/mon.c')
-rw-r--r-- | fs/lockd/mon.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 55dee3886..283d66e97 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c @@ -30,14 +30,12 @@ u32 nsm_local_state = 0; * Common procedure for SM_MON/SM_UNMON calls */ static int -nsm_mon_unmon(struct nlm_host *host, char *what, u32 proc) +nsm_mon_unmon(struct nlm_host *host, u32 proc, struct nsm_res *res) { struct rpc_clnt *clnt; int status; struct nsm_args args; - struct nsm_res res; - dprintk("lockd: nsm_%s(%s)\n", what, host->h_name); status = -EACCES; clnt = nsm_create(); if (!clnt) @@ -47,23 +45,15 @@ nsm_mon_unmon(struct nlm_host *host, char *what, u32 proc) args.prog = NLM_PROGRAM; args.vers = 1; args.proc = NLMPROC_NSM_NOTIFY; + memset(res, 0, sizeof(*res)); - status = rpc_call(clnt, proc, &args, &res, 0); - if (status < 0) { + status = rpc_call(clnt, proc, &args, res, 0); + if (status < 0) printk(KERN_DEBUG "nsm_mon_unmon: rpc failed, status=%d\n", status); - goto out; - } - - status = -EACCES; - if (res.status != 0) { - printk(KERN_NOTICE "lockd: cannot %s %s\n", what, host->h_name); - goto out; - } - - nsm_local_state = res.state; - status = 0; -out: + else + status = 0; + out: return status; } @@ -73,10 +63,16 @@ out: int nsm_monitor(struct nlm_host *host) { + struct nsm_res res; int status; - status = nsm_mon_unmon(host, "monitor", SM_MON); - if (status >= 0) + dprintk("lockd: nsm_monitor(%s)\n", host->h_name); + + status = nsm_mon_unmon(host, SM_MON, &res); + + if (status < 0 || res.status != 0) + printk(KERN_NOTICE "lockd: cannot monitor %s\n", host->h_name); + else host->h_monitored = 1; return status; } @@ -87,9 +83,15 @@ nsm_monitor(struct nlm_host *host) int nsm_unmonitor(struct nlm_host *host) { + struct nsm_res res; int status; - if ((status = nsm_mon_unmon(host, "unmonitor", SM_UNMON)) >= 0) + dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name); + + status = nsm_mon_unmon(host, SM_UNMON, &res); + if (status < 0) + printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name); + else host->h_monitored = 0; return status; } @@ -187,7 +189,7 @@ xdr_decode_stat_res(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) static int xdr_decode_stat(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) { - resp->status = ntohl(*p++); + resp->state = ntohl(*p++); return 0; } |