Skip to contentSkip to conversation

Remove un-necessary locking in lockd

PATCH New NeilBrown 1 participant 1 message Oct 20, 2003

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 Remove un-necessary locking in lockd

Two places in lockd readlock the nfsd export table before calling exp_getclient.
This is not needed because the export table is already locked by code in svc.c.
It is a problem because if a write_lock is attempted while the svc.c readlock is active, and before the secondary readlock is attempted, you get a deadlock.

----------- Diffstat output ------------

 ./fs/lockd/svc4proc.c |    2 --
 ./fs/lockd/svcproc.c  |    2 --
 2 files changed, 4 deletions(-)
fs/lockd/svc4proc.c renamed from fs/lockd/svc4proc.c~current~ +0 -2
diff ./fs/lockd/svc4proc.c~current~ ./fs/lockd/svc4proc.c
@@ -449,13 +449,11 @@ nlm4svc_proc_sm_notify(struct svc_rqst *
 	if (nlmsvc_ops != NULL) {
 		struct svc_client	*clnt;
 		saddr.sin_addr.s_addr = argp->addr;
-		nlmsvc_ops->exp_readlock();
 		if ((clnt = nlmsvc_ops->exp_getclient(&saddr)) != NULL 
 		 && (host = nlm_lookup_host(clnt, &saddr, 0, 0)) != NULL) {
 			nlmsvc_free_host_resources(host);
 		}
 		nlm_release_host(host);
-		nlmsvc_ops->exp_unlock();
 	}
 
 	return rpc_success;
fs/lockd/svcproc.c renamed from fs/lockd/svcproc.c~current~ +0 -2
diff ./fs/lockd/svcproc.c~current~ ./fs/lockd/svcproc.c
@@ -477,13 +477,11 @@ nlmsvc_proc_sm_notify(struct svc_rqst *r
 	if (nlmsvc_ops != NULL) {
 		struct svc_client	*clnt;
 		saddr.sin_addr.s_addr = argp->addr;
-		nlmsvc_ops->exp_readlock();
 		if ((clnt = nlmsvc_ops->exp_getclient(&saddr)) != NULL 
 		 && (host = nlm_lookup_host(clnt, &saddr, 0, 0)) != NULL) {
 			nlmsvc_free_host_resources(host);
 		}
 		nlm_release_host(host);
-		nlmsvc_ops->exp_unlock();
 	}
 
 	return rpc_success;

-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo The Event For Linux Datacenter Solutions & Strategies in The Enterprise Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs