diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2020-09-27 16:40:45 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2020-09-27 16:40:45 +0000 |
commit | da3d18382085f976ec3f98676f5320fabc82a5ce (patch) | |
tree | 4d8edfde15067d3f4eb12a66efb71aab2cfb6956 /sys/nfs/nfs_vnops.c | |
parent | f8ad42d384234d67b54b5212495bafb358eaeb20 (diff) |
nfs_create: after an exclusive create rpc, make sure to update
timestamps.
This issue was iscovered after rsync 3.2 changed behaviour on an NFS
mounted partition.. Change lifted from NetBSD (r 1.204).
ok beck@, kn@, deraadt@
Diffstat (limited to 'sys/nfs/nfs_vnops.c')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 88665f9a3ef..21d62b8104c 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.183 2020/06/24 22:03:44 cheloha Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.184 2020/09/27 16:40:44 matthieu Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -1414,6 +1414,7 @@ nfs_create(void *v) struct componentname *cnp = ap->a_cnp; struct nfsv2_sattr *sp; struct nfsm_info info; + struct timespec ts; u_int32_t *tl; int32_t t1; struct nfsnode *np = NULL; @@ -1486,8 +1487,14 @@ nfsmout: fmode &= ~O_EXCL; goto again; } - } else if (info.nmi_v3 && (fmode & O_EXCL)) + } else if (info.nmi_v3 && (fmode & O_EXCL)) { + getnanotime(&ts); + if (vap->va_atime.tv_sec == VNOVAL) + vap->va_atime = ts; + if (vap->va_mtime.tv_sec == VNOVAL) + vap->va_mtime = ts; error = nfs_setattrrpc(newvp, vap, cnp->cn_cred, cnp->cn_proc); + } if (!error) { if (cnp->cn_flags & MAKEENTRY) nfs_cache_enter(dvp, newvp, cnp); |