diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfs/nfs.h | 2 | ||||
-rw-r--r-- | sys/nfs/nfs_common.c | 15 | ||||
-rw-r--r-- | sys/nfs/nfs_common.h | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 15 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 4 | ||||
-rw-r--r-- | sys/nfsclient/nfs.h | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfs_subs.c | 15 | ||||
-rw-r--r-- | sys/nfsclient/nfsargs.h | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfsm_subs.h | 4 | ||||
-rw-r--r-- | sys/nfsclient/nfsstats.h | 2 | ||||
-rw-r--r-- | sys/nfsserver/nfs.h | 2 | ||||
-rw-r--r-- | sys/nfsserver/nfs_srvsubs.c | 15 | ||||
-rw-r--r-- | sys/nfsserver/nfsm_subs.h | 4 | ||||
-rw-r--r-- | sys/nfsserver/nfsrvstats.h | 2 |
14 files changed, 62 insertions, 26 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h index e07a4f5..5c5a823 100644 --- a/sys/nfs/nfs.h +++ b/sys/nfs/nfs.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index 5934465..95f7d5b 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -1203,11 +1203,12 @@ nfs_uninit(vfsp) * copy the attributes to *vaper */ int -nfs_loadattrcache(vpp, mdp, dposp, vaper) +nfs_loadattrcache(vpp, mdp, dposp, vaper, dontshrink) struct vnode **vpp; struct mbuf **mdp; caddr_t *dposp; struct vattr *vaper; + int dontshrink; { register struct vnode *vp = *vpp; register struct vattr *vap; @@ -1323,9 +1324,18 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); vap->va_filerev = 0; } + np->n_attrstamp = time_second; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { - if (np->n_flag & NMODIFIED) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { if (vap->va_size < np->n_size) vap->va_size = np->n_size; else @@ -1338,7 +1348,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) np->n_size = vap->va_size; } } - np->n_attrstamp = time_second; if (vaper != NULL) { bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); if (np->n_flag & NCHG) { diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h index b13c009..0990fe4 100644 --- a/sys/nfs/nfs_common.h +++ b/sys/nfs/nfs_common.h @@ -212,7 +212,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, #define nfsm_loadattr(v, a) \ do { \ struct vnode *ttvp = (v); \ - if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \ + if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0)) != 0) { \ error = t1; \ m_freem(mrep); \ goto nfsmout; \ @@ -226,7 +226,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ - (struct vattr *)0)) != 0) { \ + (struct vattr *)0, 1)) != 0) { \ error = t1; \ (f) = 0; \ m_freem(mrep); \ diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 5934465..95f7d5b 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1203,11 +1203,12 @@ nfs_uninit(vfsp) * copy the attributes to *vaper */ int -nfs_loadattrcache(vpp, mdp, dposp, vaper) +nfs_loadattrcache(vpp, mdp, dposp, vaper, dontshrink) struct vnode **vpp; struct mbuf **mdp; caddr_t *dposp; struct vattr *vaper; + int dontshrink; { register struct vnode *vp = *vpp; register struct vattr *vap; @@ -1323,9 +1324,18 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); vap->va_filerev = 0; } + np->n_attrstamp = time_second; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { - if (np->n_flag & NMODIFIED) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { if (vap->va_size < np->n_size) vap->va_size = np->n_size; else @@ -1338,7 +1348,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) np->n_size = vap->va_size; } } - np->n_attrstamp = time_second; if (vaper != NULL) { bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); if (np->n_flag & NCHG) { diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index b13c009..0990fe4 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -212,7 +212,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, #define nfsm_loadattr(v, a) \ do { \ struct vnode *ttvp = (v); \ - if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \ + if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0)) != 0) { \ error = t1; \ m_freem(mrep); \ goto nfsmout; \ @@ -226,7 +226,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ - (struct vattr *)0)) != 0) { \ + (struct vattr *)0, 1)) != 0) { \ error = t1; \ (f) = 0; \ m_freem(mrep); \ diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h index e07a4f5..5c5a823 100644 --- a/sys/nfsclient/nfs.h +++ b/sys/nfsclient/nfs.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index 5934465..95f7d5b 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -1203,11 +1203,12 @@ nfs_uninit(vfsp) * copy the attributes to *vaper */ int -nfs_loadattrcache(vpp, mdp, dposp, vaper) +nfs_loadattrcache(vpp, mdp, dposp, vaper, dontshrink) struct vnode **vpp; struct mbuf **mdp; caddr_t *dposp; struct vattr *vaper; + int dontshrink; { register struct vnode *vp = *vpp; register struct vattr *vap; @@ -1323,9 +1324,18 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); vap->va_filerev = 0; } + np->n_attrstamp = time_second; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { - if (np->n_flag & NMODIFIED) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { if (vap->va_size < np->n_size) vap->va_size = np->n_size; else @@ -1338,7 +1348,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) np->n_size = vap->va_size; } } - np->n_attrstamp = time_second; if (vaper != NULL) { bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); if (np->n_flag & NCHG) { diff --git a/sys/nfsclient/nfsargs.h b/sys/nfsclient/nfsargs.h index e07a4f5..5c5a823 100644 --- a/sys/nfsclient/nfsargs.h +++ b/sys/nfsclient/nfsargs.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); diff --git a/sys/nfsclient/nfsm_subs.h b/sys/nfsclient/nfsm_subs.h index b13c009..0990fe4 100644 --- a/sys/nfsclient/nfsm_subs.h +++ b/sys/nfsclient/nfsm_subs.h @@ -212,7 +212,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, #define nfsm_loadattr(v, a) \ do { \ struct vnode *ttvp = (v); \ - if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \ + if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0)) != 0) { \ error = t1; \ m_freem(mrep); \ goto nfsmout; \ @@ -226,7 +226,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ - (struct vattr *)0)) != 0) { \ + (struct vattr *)0, 1)) != 0) { \ error = t1; \ (f) = 0; \ m_freem(mrep); \ diff --git a/sys/nfsclient/nfsstats.h b/sys/nfsclient/nfsstats.h index e07a4f5..5c5a823 100644 --- a/sys/nfsclient/nfsstats.h +++ b/sys/nfsclient/nfsstats.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); diff --git a/sys/nfsserver/nfs.h b/sys/nfsserver/nfs.h index e07a4f5..5c5a823 100644 --- a/sys/nfsserver/nfs.h +++ b/sys/nfsserver/nfs.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 5934465..95f7d5b 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -1203,11 +1203,12 @@ nfs_uninit(vfsp) * copy the attributes to *vaper */ int -nfs_loadattrcache(vpp, mdp, dposp, vaper) +nfs_loadattrcache(vpp, mdp, dposp, vaper, dontshrink) struct vnode **vpp; struct mbuf **mdp; caddr_t *dposp; struct vattr *vaper; + int dontshrink; { register struct vnode *vp = *vpp; register struct vattr *vap; @@ -1323,9 +1324,18 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); vap->va_filerev = 0; } + np->n_attrstamp = time_second; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { - if (np->n_flag & NMODIFIED) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { if (vap->va_size < np->n_size) vap->va_size = np->n_size; else @@ -1338,7 +1348,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) np->n_size = vap->va_size; } } - np->n_attrstamp = time_second; if (vaper != NULL) { bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); if (np->n_flag & NCHG) { diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h index b13c009..0990fe4 100644 --- a/sys/nfsserver/nfsm_subs.h +++ b/sys/nfsserver/nfsm_subs.h @@ -212,7 +212,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, #define nfsm_loadattr(v, a) \ do { \ struct vnode *ttvp = (v); \ - if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \ + if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0)) != 0) { \ error = t1; \ m_freem(mrep); \ goto nfsmout; \ @@ -226,7 +226,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ - (struct vattr *)0)) != 0) { \ + (struct vattr *)0, 1)) != 0) { \ error = t1; \ (f) = 0; \ m_freem(mrep); \ diff --git a/sys/nfsserver/nfsrvstats.h b/sys/nfsserver/nfsrvstats.h index e07a4f5..5c5a823 100644 --- a/sys/nfsserver/nfsrvstats.h +++ b/sys/nfsserver/nfsrvstats.h @@ -616,7 +616,7 @@ int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); |