From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 14 22:46:22 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0FB6216A4D0 for ; Tue, 14 Dec 2004 22:46:22 +0000 (GMT) Received: from pun.isi.edu (pun.isi.edu [128.9.160.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id B0DE243D45 for ; Tue, 14 Dec 2004 22:46:21 +0000 (GMT) (envelope-from faber@pun.isi.edu) Received: from pun.isi.edu (localhost [127.0.0.1]) by pun.isi.edu (8.13.1/8.13.1) with ESMTP id iBEMkLlV076871 for ; Tue, 14 Dec 2004 14:46:21 -0800 (PST) (envelope-from faber@pun.isi.edu) Received: (from faber@localhost) by pun.isi.edu (8.13.1/8.13.1/Submit) id iBEMkLMl076850 for hackers@freebsd.org; Tue, 14 Dec 2004 14:46:21 -0800 (PST) (envelope-from faber) Date: Tue, 14 Dec 2004 14:46:20 -0800 From: Ted Faber To: hackers@freebsd.org Message-ID: <20041214224620.GC965@pun.isi.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/3yNEOqWowh/8j+e" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-url: http://www.isi.edu/~faber Subject: sysctl to make all nfs mounts use local file locking (patch enclosed) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Dec 2004 22:46:22 -0000 --/3yNEOqWowh/8j+e Content-Type: multipart/mixed; boundary="f0KYrhQ4vYSV2aJu" Content-Disposition: inline --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. I've recently upgraded my main work machine to -CURRENT in an environment where much of the world is mounted via NFS. The NFS locking via rpc.lockd/rpc.statd doesn't seem to be too stable, and the -L behavior described in mount_nfs(8) works much better for me. Unfortunately, I can't seem to coax the automounter into providing those kinds of mounts for me. Since I only need the local locking behavior, I create a little sysctl that adds the NFSMNT_NOLOCKD flag to any NFS mount. I've made a patch against -CURRENT for anyone who'd liek to add this functionality to their kernel. If a committer is {interested in,happy with} this patch, please feel free to commit it. And if I've missed a way to make the automounter do this, please wise me up. Thanks. -- Ted Faber http://www.isi.edu/~faber PGP: http://www.isi.edu/~faber/pubkeys.asc Unexpected attachment on this mail? See http://www.isi.edu/~faber/FAQ.html#SIG --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=nfs_patch --- nfs_vfsops.c.orig Tue Dec 7 06:26:39 2004 +++ nfs_vfsops.c Tue Dec 14 12:39:22 2004 @@ -88,6 +88,9 @@ static int nfs_ip_paranoia = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW, &nfs_ip_paranoia, 0, ""); +static int nfs_force_local_locking = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_force_local_locking, CTLFLAG_RW, + &nfs_force_local_locking, 0, ""); #ifdef NFS_DEBUG int nfs_debug; SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, ""); @@ -726,6 +729,10 @@ */ if (nfs_ip_paranoia == 0) args.flags |= NFSMNT_NOCONN; + + if (nfs_force_local_locking) + args.flags |= NFSMNT_NOLOCKD; + if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX) return (EINVAL); error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize); --f0KYrhQ4vYSV2aJu-- --/3yNEOqWowh/8j+e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBv208aUz3f+Zf+XsRAoTmAJ4zzVAuM54XJ9A+7VDxy9/yths6RACfQwMQ ZXpHlIUjRlWukvCxFqP9rGE= =FJAW -----END PGP SIGNATURE----- --/3yNEOqWowh/8j+e--