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
This commit is contained in:
parent
d16b0d7ab5
commit
2cac06495e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54693
@ -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 @@ nfsrv_writegather(ndp, 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(&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;
|
||||
}
|
||||
|
@ -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 @@ nfsrv_writegather(ndp, 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(&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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user