summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-23 21:32:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-23 21:32:34 +0000
commit9513934bb36613056f777e4f63a94c5fa9aea64e (patch)
tree1c9515f0ad53d33c5a163d4a35eb527a6ff87ac9 /sys
parentb88c8ea081c6679f381760de7b239371230553cb (diff)
sync
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_subs.c19
-rw-r--r--sys/nfs/nfs_vnops.c4
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 4a55e4de7f7..d941d979e6d 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.8 1996/05/28 13:44:08 deraadt Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.9 1996/07/23 21:32:31 deraadt Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.1 1996/05/25 22:40:34 fvdl Exp $ */
/*
@@ -56,6 +56,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/malloc.h>
+#include <sys/time.h>
#include <vm/vm.h>
@@ -610,6 +611,8 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
register int i;
struct mbuf *mreq, *mb2;
int siz, grpsiz, authsiz;
+ struct timeval tv;
+ static u_long base;
authsiz = nfsm_rndup(auth_len);
MGETHDR(mb, M_WAIT, MT_DATA);
@@ -628,8 +631,22 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
* First the RPC header.
*/
nfsm_build(tl, u_int32_t *, 8 * NFSX_UNSIGNED);
+
+ /*
+ * derive initial xid from system time
+ * XXX time is invalid if root not yet mounted
+ */
+ if (!base && (rootvp)) {
+ microtime(&tv);
+ base = tv.tv_sec << 12;
+ nfs_xid = base;
+ }
+ /*
+ * Skip zero xid if it should ever happen.
+ */
if (++nfs_xid == 0)
nfs_xid++;
+
*tl++ = *xidp = txdr_unsigned(nfs_xid);
*tl++ = rpc_call;
*tl++ = rpc_vers;
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 5a6af4a082b..be548f70cda 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.9 1996/06/14 04:41:09 tholo Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.10 1996/07/23 21:32:33 deraadt Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62 1996/05/11 18:26:49 mycroft Exp $ */
/*
@@ -697,7 +697,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
if (vap->va_atime.tv_sec != time.tv_sec) {
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
- txdr_nfsv3time(&vap->va_atime, tl);
+ txdr_nfsv3time(&vap->va_mtime, tl);
} else {
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
*tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER);