summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_bio.c11
-rw-r--r--sys/nfs/nfs_subs.c6
-rw-r--r--sys/nfs/nfs_vnops.c12
-rw-r--r--sys/nfs/nfsm_subs.h37
-rw-r--r--sys/nfs/nfsnode.h4
5 files changed, 38 insertions, 32 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index cd50fbcd023..e09ec7d2d61 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.56 2009/01/19 23:40:36 thib Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.57 2009/01/24 23:30:42 thib Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/kernel.h>
#include <sys/namei.h>
#include <sys/queue.h>
+#include <sys/time.h>
#include <uvm/uvm_extern.h>
@@ -112,16 +113,16 @@ nfs_bioread(vp, uio, ioflag, cred)
error = VOP_GETATTR(vp, &vattr, cred, p);
if (error)
return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
+ np->n_mtime = vattr.va_mtime;
} else {
error = VOP_GETATTR(vp, &vattr, cred, p);
if (error)
return (error);
- if (np->n_mtime != vattr.va_mtime.tv_sec) {
+ if (timespeccmp(&np->n_mtime, &vattr.va_mtime, !=)) {
error = nfs_vinvalbuf(vp, V_SAVE, cred, p);
if (error)
return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
+ np->n_mtime = vattr.va_mtime;
}
}
@@ -638,7 +639,7 @@ nfs_doio(bp, p)
bp->b_validend = bp->b_bcount;
}
if (p && (vp->v_flag & VTEXT) &&
- (np->n_mtime != np->n_vattr.va_mtime.tv_sec)) {
+ (timespeccmp(&np->n_mtime, &np->n_vattr.va_mtime, !=))) {
uprintf("Process killed due to text file modification\n");
psignal(p, SIGKILL);
}
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index da2c2b9158b..3e493518f5c 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.91 2009/01/20 18:03:33 blambert Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.92 2009/01/24 23:30:42 thib Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -1063,7 +1063,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
*vpp = vp = nvp;
}
}
- np->n_mtime = mtime.tv_sec;
+ np->n_mtime = mtime;
}
vap = &np->n_vattr;
vap->va_type = vtyp;
@@ -1155,7 +1155,7 @@ nfs_attrtimeo (np)
{
struct vnode *vp = np->n_vnode;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
- int tenthage = (time_second - np->n_mtime) / 10;
+ int tenthage = (time_second - np->n_mtime.tv_sec) / 10;
int minto, maxto;
if (vp->v_type == VDIR) {
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index ac5a674e310..f8a7821bdae 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.109 2009/01/24 23:25:17 thib Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.110 2009/01/24 23:30:42 thib Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -406,19 +406,19 @@ nfs_open(v)
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
if (error)
return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
+ np->n_mtime = vattr.va_mtime;
} else {
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
if (error)
return (error);
- if (np->n_mtime != vattr.va_mtime.tv_sec) {
+ if (timespeccmp(&np->n_mtime, &vattr.va_mtime, !=)) {
if (vp->v_type == VDIR)
np->n_direofoffset = 0;
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p);
if (error == EINTR)
return (error);
uvm_vnp_uncache(vp);
- np->n_mtime = vattr.va_mtime.tv_sec;
+ np->n_mtime = vattr.va_mtime;
}
}
/* For open/close consistency. */
@@ -1131,7 +1131,7 @@ nfs_writerpc(vp, uiop, iomode, must_commit)
} else
nfsm_loadattr(vp, (struct vattr *)0);
if (wccflag)
- VTONFS(vp)->n_mtime = VTONFS(vp)->n_vattr.va_mtime.tv_sec;
+ VTONFS(vp)->n_mtime = VTONFS(vp)->n_vattr.va_mtime;
m_freem(mrep);
tsiz -= len;
}
@@ -1889,7 +1889,7 @@ nfs_readdir(v)
if (np->n_direofoffset != 0 &&
uio->uio_offset == np->n_direofoffset) {
if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_procp) == 0 &&
- np->n_mtime == vattr.va_mtime.tv_sec) {
+ timespeccmp(&np->n_mtime, &vattr.va_mtime, ==)) {
nfsstats.direofcache_hits++;
*ap->a_eofflag = 1;
return (0);
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index 54014291aca..7015b6278eb 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsm_subs.h,v 1.32 2008/12/24 16:53:20 thib Exp $ */
+/* $OpenBSD: nfsm_subs.h,v 1.33 2009/01/24 23:30:42 thib Exp $ */
/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */
/*
@@ -170,21 +170,26 @@
#define NFSV3_WCCRATTR 0
#define NFSV3_WCCCHK 1
-#define nfsm_wcc_data(v, f) \
- { int ttattrf, ttretf = 0; \
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
- if (*tl == nfs_true) { \
- nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED); \
- if (f) \
- ttretf = (VTONFS(v)->n_mtime == \
- fxdr_unsigned(u_int32_t, *(tl + 2))); \
- } \
- nfsm_postop_attr((v), ttattrf); \
- if (f) { \
- (f) = ttretf; \
- } else { \
- (f) = ttattrf; \
- } }
+#define nfsm_wcc_data(v, f) do { \
+ struct timespec _mtime; \
+ int ttattrf, ttretf = 0; \
+ \
+ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
+ if (*tl == nfs_true) { \
+ nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED); \
+ fxdr_nfsv3time(tl + 2, &_mtime); \
+ if (f) { \
+ ttretf = timespeccmp(&VTONFS(v)->n_mtime, \
+ &_mtime, !=); \
+ } \
+ } \
+ nfsm_postop_attr((v), ttattrf); \
+ if (f) { \
+ (f) = ttretf; \
+ } else { \
+ (f) = ttattrf; \
+ } \
+} while (0)
#define nfsm_strsiz(s,m) \
{ nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \
diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h
index 53a3ce4ce98..2dab79a0542 100644
--- a/sys/nfs/nfsnode.h
+++ b/sys/nfs/nfsnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsnode.h,v 1.32 2009/01/19 23:40:36 thib Exp $ */
+/* $OpenBSD: nfsnode.h,v 1.33 2009/01/24 23:30:42 thib Exp $ */
/* $NetBSD: nfsnode.h,v 1.16 1996/02/18 11:54:04 fvdl Exp $ */
/*
@@ -74,7 +74,7 @@ struct nfsnode {
u_quad_t n_size; /* Current size of file */
struct vattr n_vattr; /* Vnode attribute cache */
time_t n_attrstamp; /* Attr. cache timestamp */
- time_t n_mtime; /* Prev modify time. */
+ struct timespec n_mtime; /* Prev modify time. */
time_t n_ctime; /* Prev create time. */
nfsfh_t *n_fhp; /* NFS File Handle */
struct vnode *n_vnode; /* associated vnode */