[Midnightbsd-cvs] src [8693] trunk/sys/fs/nfsserver/nfs_nfsdserv.c: make it possible to force async server side on NFS server.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 25 18:09:30 EDT 2016
Revision: 8693
http://svnweb.midnightbsd.org/src/?rev=8693
Author: laffer1
Date: 2016-09-25 18:09:30 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
make it possible to force async server side on NFS server.
Modified Paths:
--------------
trunk/sys/fs/nfsserver/nfs_nfsdserv.c
Modified: trunk/sys/fs/nfsserver/nfs_nfsdserv.c
===================================================================
--- trunk/sys/fs/nfsserver/nfs_nfsdserv.c 2016-09-25 22:09:05 UTC (rev 8692)
+++ trunk/sys/fs/nfsserver/nfs_nfsdserv.c 2016-09-25 22:09:30 UTC (rev 8693)
@@ -55,6 +55,11 @@
extern int nfsrv_enable_crossmntpt;
#endif /* !APPLEKEXT */
+static int nfs_async = 0;
+SYSCTL_DECL(_vfs_nfsd);
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0,
+ "Tell client that writes were synced even though they were not");
+
/*
* This list defines the GSS mechanisms supported.
* (Don't ask me how you get these strings from the RFC stuff like
@@ -912,7 +917,13 @@
goto out;
NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(retlen);
- if (stable == NFSWRITE_UNSTABLE)
+ /*
+ * If nfs_async is set, then pretend the write was FILESYNC.
+ * Warning: Doing this violates RFC1813 and runs a risk
+ * of data written by a client being lost when the server
+ * crashes/reboots.
+ */
+ if (stable == NFSWRITE_UNSTABLE && nfs_async == 0)
*tl++ = txdr_unsigned(stable);
else
*tl++ = txdr_unsigned(NFSWRITE_FILESYNC);
More information about the Midnightbsd-cvs
mailing list