From 8eaa4f53e459fa71fae49ba6fbcc8ddcf23682b0 Mon Sep 17 00:00:00 2001 From: ps Date: Mon, 6 Dec 2004 19:18:00 +0000 Subject: 2 fixes that improve on the consistency of the NFS client cache. - Change the cached mtime to a 'struct timespec' from a time_t. Improving the precision of the cached mtime tightens up NFS' "close-to-open" consistency considerably. - Always force an over-the-wire consistency check from nfs_open() (unless the file is marked modified). This further improves NFS' "close-to-open" consistency. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com --- sys/nfsclient/nfs_bio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/nfsclient/nfs_bio.c') diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 9fd12a1..bc2cf53 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -396,19 +396,19 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) error = VOP_GETATTR(vp, &vattr, cred, td); 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, td); if (error) return (error); if ((np->n_flag & NSIZECHANGED) - || (np->n_mtime != vattr.va_mtime.tv_sec)) { + || (NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime))) { if (vp->v_type == VDIR) (nmp->nm_rpcops->nr_invaldir)(vp); error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); - np->n_mtime = vattr.va_mtime.tv_sec; + np->n_mtime = vattr.va_mtime; np->n_flag &= ~NSIZECHANGED; } } @@ -1318,7 +1318,7 @@ nfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td) } /* ASSERT_VOP_LOCKED(vp, "nfs_doio"); */ if (p && (vp->v_vflag & VV_TEXT) && - (np->n_mtime != np->n_vattr.va_mtime.tv_sec)) { + (NFS_TIMESPEC_COMPARE(&np->n_mtime, &np->n_vattr.va_mtime))) { PROC_LOCK(p); killproc(p, "text file modification"); PROC_UNLOCK(p); -- cgit v1.1