sysctl to make all nfs mounts use local file locking (patch
enclosed)
Ted Faber
faber at isi.edu
Tue Dec 14 14:46:22 PST 2004
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
-------------- next part --------------
--- 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);
-------------- 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-hackers/attachments/20041214/1537481b/attachment.bin
More information about the freebsd-hackers
mailing list