Hi, all! 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.>From time to time we experience processes on the NFS clientshanging in statd "D" with wchan "lockd" when accessing files over NFS. So, just to nail down the cause of the problem we wanted to disable remote locking for some time and see, what happens. I know, it would probably be better to update the server, but if everything works OK without locking, at least we know that NFS locking is the problem here. Now, I'm a little bit puzzled by the documentation, even the one on the newer 6.0 systems ;-) I have this line in /etc/fstab now: hugo10:/home /home nfs rw,-b,-i,-L 0 0 according to the manpage for mount_nfs. Yet, when I type "mount" to check if the options specified really are active, I get: # mount ... hugo10:/home on /home (nfs) ... Eh ... yes? How can I check with which NFS options a given directory is actually mounted? Next question - while checking the manpages: # man rc.conf ... rpc_lockd_enable (bool) If set to ``YES'' and also an NFS server, run rpc.lockd(8) at boot time. rpc_statd_enable (bool) If set to ``YES'' and also an NFS server, run rpc.statd(8) at boot time. ... # man mount_nfs ... -L Do not forward fcntl(2) locks over the wire. All locks will be local and not seen by the server and likewise not seen by other NFS clients. This removes the need to run the rpcbind(8) service and the rpc.statd(8) and rpc.lockd(8) servers on the client. Note that this option will only be honored when performing the initial mount, it will be silently ignored if used while updating the mount options. ... So: what about this "this removes the need to run ... on the client"? rc.conf(5) implies that nfs.statd and nfs.lockd are only run on NFS servers. Could someone please give me a quick picture on how the various parts are supposed to work together? A link to TFM will be appreciated just as well ;-) And a last, minor one: when and why was the behaviour from older releases changed (at least in 4.x things used to be that way, I remember) that when I set "nfs_server_enable" in rc.conf, mountd and portmapper were implicitly started because being an NFS server depends on these services running? Seems like now I have to explicitly enable "mountd_enable" and "rpcbind_enable", too - what's the point in running nfsd wihtout mountd and rpcbind? Wasn't one of the reasons for rcng the need to handle dependencies? Thanks in advance, Patrick -- punkt.de GmbH Internet - Dienstleistungen - Beratung Vorholzstr. 25 Tel. 0721 9109 -0 Fax: -100 76137 Karlsruhe http://punkt.de
On Tue, Feb 28, 2006 at 11:14:53AM +0100, Patrick M. Hausen wrote:> Hi, all! > > 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. > > >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 ==================================================================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 */ -#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 = getnameinfo(host_addr, host_addr->sa_len, host, sizeof host, - NULL, 0, NI_NUMERICHOST); - if (error != 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) != 0) { + syslog(LOG_ERR, "unable to get name string for caller"); return NULL; } @@ -566,7 +562,8 @@ res.cookie = arg->cookie; res.stat.stat = 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)); return (NULL); } @@ -620,7 +617,8 @@ * a lock to cancel, so this call always fails. */ res.stat.stat = 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); } @@ -667,7 +665,8 @@ res.stat.stat = unlock(&arg4, 0); res.cookie = arg->cookie; - transmit_result(NLM_UNLOCK_RES, &res, getrpcaddr(rqstp)); + transmit_result(NLM_UNLOCK_RES, &res, + (struct sockaddr *)svc_getcaller(rqstp->rq_xprt)); return (NULL); } @@ -724,7 +723,8 @@ nlm_granted, NULL, NLM_VERS) == 0 ? nlm_granted : nlm_denied; - transmit_result(NLM_GRANTED_RES, &res, getrpcaddr(rqstp)); + transmit_result(NLM_GRANTED_RES, &res, + (struct sockaddr *)svc_getcaller(rqstp->rq_xprt)); return (NULL); } @@ -1067,7 +1067,8 @@ res.cookie = arg->cookie; res.stat.stat = 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)); return (NULL); } @@ -1115,7 +1116,8 @@ * a lock to cancel, so this call always fails. */ res.stat.stat = 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); } @@ -1156,7 +1158,8 @@ res.stat.stat = unlock(&arg->alock, LOCK_V4); res.cookie = arg->cookie; - transmit4_result(NLM4_UNLOCK_RES, &res, getrpcaddr(rqstp)); + transmit4_result(NLM4_UNLOCK_RES, &res, + (struct sockaddr *)svc_getcaller(rqstp->rq_xprt)); return (NULL); } @@ -1212,7 +1215,8 @@ 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, getrpcaddr(rqstp)); + transmit4_result(NLM4_GRANTED_RES, &res, + (struct sockaddr *)svc_getrpccaller(rqstp->rq_xprt)->buf); return (NULL); } Kris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060228/d5d714f9/attachment-0001.bin
Hi, Kris! On Tue, Feb 28, 2006 at 05:21:50AM -0500, Kris Kennaway wrote:> Try the attached patch on the 6.0 machines:Thanks. Will do. But:> Index: usr.sbin/rpc.lockd/lock_proc.c > ...So, rpc.lockd _is_ needed on the client? What about the statement in rc.conf(5) then, claiming it was only started on servers? Thanks, Patrick -- punkt.de GmbH Internet - Dienstleistungen - Beratung Vorholzstr. 25 Tel. 0721 9109 -0 Fax: -100 76137 Karlsruhe http://punkt.de
On Tue, Feb 28, 2006 at 05:21:50AM -0500, Kris Kennaway wrote:> On Tue, Feb 28, 2006 at 11:14:53AM +0100, Patrick M. Hausen wrote: > > Hi, all! > > > > 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. > > > > >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<snip> Hi, I have been plagued with this NFS lockd issue for quite some time now. It has kept me from installing FreeBSD 6.x on our workstations at work. I just tried applying your patch to my own 6.1-RELEASE-p3 workstation, and so far it has been working nicely. Has anyone else had the same experience? If so, maybe it should go into production? with regards, -- Morten A. Middelthon "For every complex problem, there is a solution that is simple, neat, and wrong. -- H.L. Mencken -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060815/c04cb7f9/attachment.pgp