From owner-freebsd-stable@FreeBSD.ORG Tue Feb 28 10:21:51 2006 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDAC116A420 for ; Tue, 28 Feb 2006 10:21:51 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B6D643D46 for ; Tue, 28 Feb 2006 10:21:51 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196]) by elvis.mu.org (Postfix) with ESMTP id 43F071A4E50; Tue, 28 Feb 2006 02:21:51 -0800 (PST) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 8E3C253664; Tue, 28 Feb 2006 05:21:50 -0500 (EST) Date: Tue, 28 Feb 2006 05:21:50 -0500 From: Kris Kennaway To: "Patrick M. Hausen" Message-ID: <20060228102150.GA56625@xor.obsecurity.org> References: <20060228101453.GB47953@hugo10.ka.punkt.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <20060228101453.GB47953@hugo10.ka.punkt.de> User-Agent: Mutt/1.4.2.1i Cc: stable@freebsd.org Subject: Re: NFS locking question X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2006 10:21:51 -0000 --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--