summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>1999-12-16 17:01:32 +0000
committerdillon <dillon@FreeBSD.org>1999-12-16 17:01:32 +0000
commitdb701263c188f477549acf3d2ea91304faa1e0cc (patch)
tree5dc361c269bd8b691d607c06fee068a4c26084d2 /sys
parent893d71046765883032225f4a18afe0fcc33b788a (diff)
downloadFreeBSD-src-db701263c188f477549acf3d2ea91304faa1e0cc.zip
FreeBSD-src-db701263c188f477549acf3d2ea91304faa1e0cc.tar.gz
Have NFS use a snapshot of boottime instead of boottime itself to
generate the NFSv3 Version id. boottime itself may change, sometimes once every tick if you are running xntpd, which really throws off clients. Clients will tend to throw away what they believe to be stale data too often, and can get into long loops rewriting the same data over and over again because they believe the server has rebooted over and over again due to the changing version id. Approved by: jkh
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_serv.c20
-rw-r--r--sys/nfsserver/nfs_serv.c20
2 files changed, 28 insertions, 12 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 405e437..d535483 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -133,6 +133,8 @@ extern struct nfsstats nfsstats;
int nfsrvw_procrastinate = NFS_GATHERDELAY * 1000;
int nfsrvw_procrastinate_v3 = 0;
+static struct timeval nfsver = { 0 };
+
SYSCTL_DECL(_vfs_nfs);
static int nfs_async;
@@ -1192,8 +1194,10 @@ nfsrv_write(nfsd, slp, procp, mrq)
* but it may make the values more human readable,
* for debugging purposes.
*/
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR);
nfsm_srvfillattr(vap, fp);
@@ -1478,8 +1482,10 @@ loop1:
* but it may make the values more human readable,
* for debugging purposes.
*/
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR);
nfsm_srvfillattr(&va, fp);
@@ -3681,8 +3687,10 @@ nfsrv_commit(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(for_ret, &bfor, aft_ret, &aft);
if (!error) {
nfsm_build(tl, u_int32_t *, NFSX_V3WRITEVERF);
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
error = 0;
}
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index 405e437..d535483 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -133,6 +133,8 @@ extern struct nfsstats nfsstats;
int nfsrvw_procrastinate = NFS_GATHERDELAY * 1000;
int nfsrvw_procrastinate_v3 = 0;
+static struct timeval nfsver = { 0 };
+
SYSCTL_DECL(_vfs_nfs);
static int nfs_async;
@@ -1192,8 +1194,10 @@ nfsrv_write(nfsd, slp, procp, mrq)
* but it may make the values more human readable,
* for debugging purposes.
*/
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR);
nfsm_srvfillattr(vap, fp);
@@ -1478,8 +1482,10 @@ loop1:
* but it may make the values more human readable,
* for debugging purposes.
*/
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR);
nfsm_srvfillattr(&va, fp);
@@ -3681,8 +3687,10 @@ nfsrv_commit(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(for_ret, &bfor, aft_ret, &aft);
if (!error) {
nfsm_build(tl, u_int32_t *, NFSX_V3WRITEVERF);
- *tl++ = txdr_unsigned(boottime.tv_sec);
- *tl = txdr_unsigned(boottime.tv_usec);
+ if (nfsver.tv_sec == 0)
+ nfsver = boottime;
+ *tl++ = txdr_unsigned(nfsver.tv_sec);
+ *tl = txdr_unsigned(nfsver.tv_usec);
} else {
error = 0;
}
OpenPOWER on IntegriCloud