Deleted Added
full compact
36c36
< __FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vnops.c 224733 2011-08-09 15:29:58Z jhb $");
---
> __FBSDID("$FreeBSD: head/sys/nfsclient/nfs_vnops.c 230394 2012-01-20 20:02:01Z jhb $");
916c916
< struct timespec dmtime;
---
> struct timespec nctime;
925c925
< int error = 0, attrflag, fhsize, ltype;
---
> int error = 0, attrflag, dattrflag, fhsize, ltype, ncticks;
941c941
< error = cache_lookup(dvp, vpp, cnp);
---
> error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks);
945a946,958
> * Lookups of "." are special and always return the
> * current directory. cache_lookup() already handles
> * associated locking bookkeeping, etc.
> */
> if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
> /* XXX: Is this really correct? */
> if (cnp->cn_nameiop != LOOKUP &&
> (flags & ISLASTCN))
> cnp->cn_flags |= SAVENAME;
> return (0);
> }
>
> /*
971c984
< timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) {
---
> timespeccmp(&vattr.va_ctime, &nctime, ==)) {
990,993c1003,1007
< * our cached copy. Otherwise, we discard all of the
< * negative cache entries for this directory. We also
< * only trust -ve cache entries for less than
< * nm_negative_namecache_timeout seconds.
---
> * the cached copy in the name cache entry.
> * Otherwise, we discard all of the negative cache
> * entries for this directory. We also only trust
> * negative cache entries for up to nm_negnametimeo
> * seconds.
995,996c1009
< if ((u_int)(ticks - np->n_dmtime_ticks) <
< (nmp->nm_negnametimeo * hz) &&
---
> if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) &&
998c1011
< timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) {
---
> timespeccmp(&vattr.va_mtime, &nctime, ==)) {
1003,1005d1015
< mtx_lock(&np->n_mtx);
< timespecclear(&np->n_dmtime);
< mtx_unlock(&np->n_mtx);
1008,1019c1018
< /*
< * Cache the modification time of the parent directory in case
< * the lookup fails and results in adding the first negative
< * name cache entry for the directory. Since this is reading
< * a single time_t, don't bother with locking. The
< * modification time may be a bit stale, but it must be read
< * before performing the lookup RPC to prevent a race where
< * another lookup updates the timestamp on the directory after
< * the lookup RPC has been performed on the server but before
< * n_dmtime is set at the end of this function.
< */
< dmtime = np->n_vattr.va_mtime;
---
> attrflag = dattrflag = 0;
1034c1033
< nfsm_postop_attr(dvp, attrflag);
---
> nfsm_postop_attr_va(dvp, dattrflag, &vattr);
1130,1133c1129,1134
< nfsm_postop_attr(newvp, attrflag);
< nfsm_postop_attr(dvp, attrflag);
< } else
< nfsm_loadattr(newvp, NULL);
---
> nfsm_postop_attr_va(newvp, attrflag, &vattr);
> nfsm_postop_attr(dvp, dattrflag);
> } else {
> nfsm_loadattr(newvp, &vattr);
> attrflag = 1;
> }
1137,1139c1138,1139
< (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) {
< np->n_ctime = np->n_vattr.va_ctime;
< cache_enter(dvp, newvp, cnp);
---
> (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && attrflag) {
> cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime);
1167c1167,1168
< if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) {
---
> if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE &&
> dattrflag) {
1169,1181c1170,1175
< * Maintain n_dmtime as the modification time
< * of the parent directory when the oldest -ve
< * name cache entry for this directory was
< * added. If a -ve cache entry has already
< * been added with a newer modification time
< * by a concurrent lookup, then don't bother
< * adding a cache entry. The modification
< * time of the directory might have changed
< * due to the file this lookup failed to find
< * being created. In that case a subsequent
< * lookup would incorrectly use the entry
< * added here instead of doing an extra
< * lookup.
---
> * Cache the modification time of the parent
> * directory from the post-op attributes in
> * the name cache entry. The negative cache
> * entry will be ignored once the directory
> * has changed. Don't bother adding the entry
> * if the directory has already changed.
1184,1188c1178,1179
< if (timespeccmp(&np->n_dmtime, &dmtime, <=)) {
< if (!timespecisset(&np->n_dmtime)) {
< np->n_dmtime = dmtime;
< np->n_dmtime_ticks = ticks;
< }
---
> if (timespeccmp(&np->n_vattr.va_mtime,
> &vattr.va_mtime, ==)) {
1190c1181,1182
< cache_enter(dvp, NULL, cnp);
---
> cache_enter_time(dvp, NULL, cnp,
> &vattr.va_mtime);
2475a2468
> struct vattr vattr;
2656c2649
< nfsm_loadattr(newvp, NULL);
---
> nfsm_loadattr(newvp, &vattr);
2659,2660c2652
< dp->d_type =
< IFTODT(VTTOIF(np->n_vattr.va_type));
---
> dp->d_type = IFTODT(VTTOIF(vattr.va_type));
2662,2667c2654,2655
< /*
< * Update n_ctime so subsequent lookup
< * doesn't purge entry.
< */
< np->n_ctime = np->n_vattr.va_ctime;
< cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp);
---
> cache_enter_time(ndp->ni_dvp, ndp->ni_vp, cnp,
> &vattr.va_ctime);