From 1870b993d0f04ab08999bfee401b1b992d3355a4 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Wed, 14 May 2003 13:50:40 +0000 Subject: [PATCH] When receiving NLM_GRANTED_RES or NLM4_GRANTED_RES lock granted messages from the NFS server, following contention on a lock by this or another client, immediately notify the waiting process that the lock has been granted via a wakeup. Without this change, the client rpc.lockd will not wakeup the waiting process until it next re-polls the lock (sometime in the next ten seconds), which can lead to marked latency across all potential lockers, as the lock is held by the client for the duration. Approved by: re (scottl) Submitted by: truckman Reviewed by: Andrew P. Lentvorski, Jr --- usr.sbin/rpc.lockd/lock_proc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.sbin/rpc.lockd/lock_proc.c b/usr.sbin/rpc.lockd/lock_proc.c index f0ded1ddd058..255072aa1539 100644 --- a/usr.sbin/rpc.lockd/lock_proc.c +++ b/usr.sbin/rpc.lockd/lock_proc.c @@ -695,7 +695,10 @@ nlm_granted_msg_1_svc(arg, rqstp) log_from_addr("nlm_granted_msg", rqstp); res.cookie = arg->cookie; - res.stat.stat = nlm_granted; + res.stat.stat = lock_answer(arg->alock.svid, &arg->cookie, + nlm_granted, NULL, NLM_VERS) == 0 ? + nlm_granted : nlm_denied; + transmit_result(NLM_GRANTED_RES, &res, (struct sockaddr *)svc_getcaller(rqstp->rq_xprt)); return (NULL); @@ -1184,7 +1187,9 @@ nlm4_granted_msg_4_svc(arg, rqstp) log_from_addr("nlm4_granted_msg", rqstp); res.cookie = arg->cookie; - res.stat.stat = nlm4_granted; + res.stat.stat = lock_answer(arg->alock.svid, &arg->cookie, + nlm4_granted, NULL, NLM_VERS4) == 0 ? + nlm4_granted : nlm4_denied; transmit4_result(NLM4_GRANTED_RES, &res, (struct sockaddr *)svc_getrpccaller(rqstp->rq_xprt)->buf); return (NULL);