diff options
author | ps <ps@FreeBSD.org> | 2004-12-06 19:18:00 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2004-12-06 19:18:00 +0000 |
commit | 8eaa4f53e459fa71fae49ba6fbcc8ddcf23682b0 (patch) | |
tree | 4019db19520d82d9c16a47c76254153364dbc9eb /sys/nfsclient/nfs_bio.c | |
parent | b894547e6f605eea5875525ab3a9550c942206a6 (diff) | |
download | FreeBSD-src-8eaa4f53e459fa71fae49ba6fbcc8ddcf23682b0.zip FreeBSD-src-8eaa4f53e459fa71fae49ba6fbcc8ddcf23682b0.tar.gz |
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
Diffstat (limited to 'sys/nfsclient/nfs_bio.c')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 8 |
1 files changed, 4 insertions, 4 deletions
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); |