Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2006 05:21:50 -0500
From:      Kris Kennaway <kris@obsecurity.org>
To:        "Patrick M. Hausen" <hausen@punkt.de>
Cc:        stable@freebsd.org
Subject:   Re: NFS locking question
Message-ID:  <20060228102150.GA56625@xor.obsecurity.org>
In-Reply-To: <20060228101453.GB47953@hugo10.ka.punkt.de>
References:  <20060228101453.GB47953@hugo10.ka.punkt.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 28, 2006 at 11:14:53AM +0100, Patrick M. Hausen wrote:
> Hi, all!
>=20
> In our local office network we have a rather old FreeBSD 5.2.1
> server acting as an NFS server for several other systems, mostly
> running 6.0.
>=20
> >From time to time we experience processes on the NFS clients
> hanging in statd "D" with wchan "lockd" when accessing files
> over NFS.

Try the attached patch on the 6.0 machines:

Index: usr.sbin/rpc.lockd/lock_proc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.sbin/rpc.lockd/lock_proc.c,v
retrieving revision 1.18
retrieving revision 1.17
diff -u -u -r1.18 -r1.17
--- usr.sbin/rpc.lockd/lock_proc.c	3 Feb 2005 22:21:19 -0000	1.18
+++ usr.sbin/rpc.lockd/lock_proc.c	9 Oct 2004 15:36:13 -0000	1.17
@@ -62,8 +62,6 @@
 #define	CLIENT_CACHE_SIZE	64	/* No. of client sockets cached */
 #define	CLIENT_CACHE_LIFETIME	120	/* In seconds */
=20
-#define	getrpcaddr(rqstp)	(struct sockaddr *)(svc_getrpccaller((rqstp)->rq=
_xprt)->buf)
-
 static void	log_from_addr(const char *, struct svc_req *);
 static void	log_netobj(netobj *obj);
 static int	addrcmp(struct sockaddr *, struct sockaddr *);
@@ -196,7 +194,7 @@
 {
 	CLIENT *client;
 	struct timeval retry_time, time_now;
-	int error, i;
+	int i;
 	const char *netid;
 	struct netconfig *nconf;
 	char host[NI_MAXHOST];
@@ -243,11 +241,9 @@
 	 * Need a host string for clnt_tp_create. Use NI_NUMERICHOST
 	 * to avoid DNS lookups.
 	 */
-	error =3D getnameinfo(host_addr, host_addr->sa_len, host, sizeof host,
-			    NULL, 0, NI_NUMERICHOST);
-	if (error !=3D 0) {
-		syslog(LOG_ERR, "unable to get name string for caller: %s",
-		       gai_strerror(error));
+	if (getnameinfo(host_addr, host_addr->sa_len, host, sizeof host,
+	    NULL, 0, NI_NUMERICHOST) !=3D 0) {
+		syslog(LOG_ERR, "unable to get name string for caller");
 		return NULL;
 	}
=20
@@ -566,7 +562,8 @@
=20
 	res.cookie =3D arg->cookie;
 	res.stat.stat =3D getlock(&arg4, rqstp, LOCK_ASYNC | LOCK_MON);
-	transmit_result(NLM_LOCK_RES, &res, getrpcaddr(rqstp));
+	transmit_result(NLM_LOCK_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
=20
 	return (NULL);
 }
@@ -620,7 +617,8 @@
 	 * a lock to cancel, so this call always fails.
 	 */
 	res.stat.stat =3D unlock(&arg4, LOCK_CANCEL);
-	transmit_result(NLM_CANCEL_RES, &res, getrpcaddr(rqstp));
+	transmit_result(NLM_CANCEL_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
 	return (NULL);
 }
=20
@@ -667,7 +665,8 @@
 	res.stat.stat =3D unlock(&arg4, 0);
 	res.cookie =3D arg->cookie;
=20
-	transmit_result(NLM_UNLOCK_RES, &res, getrpcaddr(rqstp));
+	transmit_result(NLM_UNLOCK_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
 	return (NULL);
 }
=20
@@ -724,7 +723,8 @@
 		nlm_granted, NULL, NLM_VERS) =3D=3D 0 ?
 		nlm_granted : nlm_denied;
=20
-	transmit_result(NLM_GRANTED_RES, &res, getrpcaddr(rqstp));
+	transmit_result(NLM_GRANTED_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
 	return (NULL);
 }
=20
@@ -1067,7 +1067,8 @@
=20
 	res.cookie =3D arg->cookie;
 	res.stat.stat =3D getlock(arg, rqstp, LOCK_MON | LOCK_ASYNC | LOCK_V4);
-	transmit4_result(NLM4_LOCK_RES, &res, getrpcaddr(rqstp));
+	transmit4_result(NLM4_LOCK_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
=20
 	return (NULL);
 }
@@ -1115,7 +1116,8 @@
 	 * a lock to cancel, so this call always fails.
 	 */
 	res.stat.stat =3D unlock(&arg->alock, LOCK_CANCEL | LOCK_V4);
-	transmit4_result(NLM4_CANCEL_RES, &res, getrpcaddr(rqstp));
+	transmit4_result(NLM4_CANCEL_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
 	return (NULL);
 }
=20
@@ -1156,7 +1158,8 @@
 	res.stat.stat =3D unlock(&arg->alock, LOCK_V4);
 	res.cookie =3D arg->cookie;
=20
-	transmit4_result(NLM4_UNLOCK_RES, &res, getrpcaddr(rqstp));
+	transmit4_result(NLM4_UNLOCK_RES, &res,
+	    (struct sockaddr *)svc_getcaller(rqstp->rq_xprt));
 	return (NULL);
 }
=20
@@ -1212,7 +1215,8 @@
 	res.stat.stat =3D lock_answer(arg->alock.svid, &arg->cookie,
 		nlm4_granted, NULL, NLM_VERS4) =3D=3D 0 ?
 		nlm4_granted : nlm4_denied;
-	transmit4_result(NLM4_GRANTED_RES, &res, getrpcaddr(rqstp));
+	transmit4_result(NLM4_GRANTED_RES, &res,
+	    (struct sockaddr *)svc_getrpccaller(rqstp->rq_xprt)->buf);
 	return (NULL);
 }
=20
Kris
--vkogqOf2sHV7VnPd
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (FreeBSD)

iD8DBQFEBCQ+Wry0BWjoQKURAo7ZAKDTHBKzTzKlShnsMes+no0t9CGrYQCfa0DL
AgfRcLt9zCVkFbuV1s5gloc=
=pizb
-----END PGP SIGNATURE-----

--vkogqOf2sHV7VnPd--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060228102150.GA56625>