lockd: separate client and server hosts
Subsystems (2)
PATCH 1/1 lockd: separate client and server hosts
Hi,
I implemented what Trond suggested for separating client and server hosts. A very basic test (all on the same host...) shown no problem.
It seems to me that the existing code should have been associated with bugs, as the hosts known by the server were registered in the hash with their clnt ref, or with the address of the host. There should have been trouble when the server found a bad one. Maybe it never showed up or in very rare cases (or maybe I misunderstand some part of the code) (it is only a supposition as I haven't thought about a real case where such a problem could happen).
Pat
fs/lockd/host.c +1 -1
@@ -62,7 +62,7 @@ nlm_match_host(struct nlm_host *host, struct svc_client *clnt, struct sockaddr_in *sin) { - if (clnt) + if (clnt || host->h_exportent) return host->h_exportent == clnt; return nlm_cmp_addr(&host->h_addr, sin); }
fs/lockd/svc4proc.c +3 -1
@@ -470,8 +470,10 @@if (!(call =nlmclnt_alloc_call ()))return rpc_system_err; - host =nlmclnt_lookup_host (&rqstp->rq_addr, +if (proc ==NLMPROC_GRANTED_RES ) + host =nlmclnt_lookup_host (&rqstp->rq_addr, rqstp->rq_prot, rqstp->rq_vers); +else host =nlmsvc_lookup_host (rqstp);if (!host) {kfree (call);return rpc_system_err;
fs/lockd/svclock.c +1 -2
@@ -176,8 +176,7 @@struct nlm_rqst *call;/* Create host handle for callback */ - host =nlmclnt_lookup_host (&rqstp->rq_addr, - rqstp->rq_prot, rqstp->rq_vers); + host =nlmsvc_lookup_host (rqstp);if (host ==NULL )return NULL ;
fs/lockd/svcproc.c +3 -1
@@ -498,8 +498,10 @@if (!(call =nlmclnt_alloc_call ()))return rpc_system_err; - host =nlmclnt_lookup_host (&rqstp->rq_addr, +if (proc ==NLMPROC_GRANTED_RES ) + host =nlmclnt_lookup_host (&rqstp->rq_addr, rqstp->rq_prot, rqstp->rq_vers); +else host =nlmsvc_lookup_host (rqstp);if (!host) {kfree (call);return rpc_system_err;