SCCS-vsn: sys/kern/vfs_lookup.c 7.26
SCCS-vsn: sys/kern/vfs_cache.c 7.8
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 7.26
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 7.26
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)vfs_cache.c 7.7 (Berkeley) %G%
+ * @(#)vfs_cache.c 7.8 (Berkeley) %G%
if (!ndp->ni_makeentry) {
nchstats.ncs_badhits++;
} else if (ncp->nc_vp == NULL) {
if (!ndp->ni_makeentry) {
nchstats.ncs_badhits++;
} else if (ncp->nc_vp == NULL) {
- nchstats.ncs_neghits++;
- /*
- * move this slot to end of LRU chain, if not already there
- */
- if (ncp->nc_nxt) {
- /* remove from LRU chain */
- *ncp->nc_prev = ncp->nc_nxt;
- ncp->nc_nxt->nc_prev = ncp->nc_prev;
- /* and replace at end of it */
- ncp->nc_nxt = NULL;
- ncp->nc_prev = nchtail;
- *nchtail = ncp;
- nchtail = &ncp->nc_nxt;
+ if ((ndp->ni_nameiop & OPMASK) != CREATE) {
+ nchstats.ncs_neghits++;
+ /*
+ * Move this slot to end of LRU chain,
+ * if not already there.
+ */
+ if (ncp->nc_nxt) {
+ /* remove from LRU chain */
+ *ncp->nc_prev = ncp->nc_nxt;
+ ncp->nc_nxt->nc_prev = ncp->nc_prev;
+ /* and replace at end of it */
+ ncp->nc_nxt = NULL;
+ ncp->nc_prev = nchtail;
+ *nchtail = ncp;
+ nchtail = &ncp->nc_nxt;
+ }
+ return (ENOENT);
} else if (ncp->nc_vpid != ncp->nc_vp->v_id) {
nchstats.ncs_falsehits++;
} else {
} else if (ncp->nc_vpid != ncp->nc_vp->v_id) {
nchstats.ncs_falsehits++;
} else {
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)vfs_lookup.c 7.25 (Berkeley) %G%
+ * @(#)vfs_lookup.c 7.26 (Berkeley) %G%
lockparent = ndp->ni_nameiop & LOCKPARENT;
docache = (ndp->ni_nameiop & NOCACHE) ^ NOCACHE;
getbuf = (ndp->ni_nameiop & HASBUF) ^ HASBUF;
lockparent = ndp->ni_nameiop & LOCKPARENT;
docache = (ndp->ni_nameiop & NOCACHE) ^ NOCACHE;
getbuf = (ndp->ni_nameiop & HASBUF) ^ HASBUF;
- if (flag == DELETE || wantparent)
+ if (flag == DELETE || (wantparent && flag != CREATE))
docache = 0;
rdonly = MNT_RDONLY;
if (ndp->ni_nameiop & REMOTE)
docache = 0;
rdonly = MNT_RDONLY;
if (ndp->ni_nameiop & REMOTE)
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_lookup.c 7.25 (Berkeley) %G%
+ * @(#)ufs_lookup.c 7.26 (Berkeley) %G%
} else if (ndp->ni_isdotdot) {
IUNLOCK(pdp);
error = vget(vdp);
} else if (ndp->ni_isdotdot) {
IUNLOCK(pdp);
error = vget(vdp);
+ if (!error && lockparent && *ndp->ni_next == '\0')
+ ILOCK(pdp);
} else {
error = vget(vdp);
} else {
error = vget(vdp);
+ if (!lockparent || error || *ndp->ni_next != '\0')
+ IUNLOCK(pdp);
}
/*
* Check that the capability number did not change
}
/*
* Check that the capability number did not change
if (!error) {
if (vpid == vdp->v_id)
return (0);
if (!error) {
if (vpid == vdp->v_id)
return (0);
+ iput(dp);
+ if (lockparent && pdp != dp && *ndp->ni_next == '\0')
+ IUNLOCK(pdp);
/*
* Insert name into cache (as non-existent) if appropriate.
*/
/*
* Insert name into cache (as non-existent) if appropriate.
*/
+ if (ndp->ni_makeentry && flag != CREATE)
cache_enter(ndp);
return (ENOENT);
cache_enter(ndp);
return (ENOENT);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_lookup.c 7.25 (Berkeley) %G%
+ * @(#)ufs_lookup.c 7.26 (Berkeley) %G%
} else if (ndp->ni_isdotdot) {
IUNLOCK(pdp);
error = vget(vdp);
} else if (ndp->ni_isdotdot) {
IUNLOCK(pdp);
error = vget(vdp);
+ if (!error && lockparent && *ndp->ni_next == '\0')
+ ILOCK(pdp);
} else {
error = vget(vdp);
} else {
error = vget(vdp);
+ if (!lockparent || error || *ndp->ni_next != '\0')
+ IUNLOCK(pdp);
}
/*
* Check that the capability number did not change
}
/*
* Check that the capability number did not change
if (!error) {
if (vpid == vdp->v_id)
return (0);
if (!error) {
if (vpid == vdp->v_id)
return (0);
+ iput(dp);
+ if (lockparent && pdp != dp && *ndp->ni_next == '\0')
+ IUNLOCK(pdp);
/*
* Insert name into cache (as non-existent) if appropriate.
*/
/*
* Insert name into cache (as non-existent) if appropriate.
*/
+ if (ndp->ni_makeentry && flag != CREATE)
cache_enter(ndp);
return (ENOENT);
cache_enter(ndp);
return (ENOENT);