diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-28 13:56:56 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-28 13:56:56 +0000 |
commit | a5324b331dc9d9f9a7f1eb79d9c301fee19e8f28 (patch) | |
tree | d4dea0acc4bc4b5e61b11d040dd8caaf4b408bfc /sys/kern | |
parent | efb09df0e7e51325c02defc1b8fd5a08c4ab0f9a (diff) | |
download | FreeBSD-src-a5324b331dc9d9f9a7f1eb79d9c301fee19e8f28.zip FreeBSD-src-a5324b331dc9d9f9a7f1eb79d9c301fee19e8f28.tar.gz |
- Remove an unused variable from relookup().
- Assert that REMOVE, CREATE, and RENAME callers have WANTPARENT
or LOCKPARENT set. You can't complete any of these operations without
at least a reference to the parent. Many filesystems check for this case
even though it isn't possible in the current system.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_lookup.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 6596eb9..6b8b806 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -352,6 +352,8 @@ lookup(ndp) vfslocked = (ndp->ni_cnd.cn_flags & GIANTHELD) != 0; ndp->ni_cnd.cn_flags &= ~GIANTHELD; wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT); + KASSERT(cnp->cn_nameiop == LOOKUP || wantparent, + ("CREATE, DELETE, RENAME require LOCKPARENT or WANTPARENT.")); docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; if (cnp->cn_nameiop == DELETE || (wantparent && cnp->cn_nameiop != CREATE && @@ -710,7 +712,6 @@ relookup(dvp, vpp, cnp) { struct thread *td = cnp->cn_thread; struct vnode *dp = 0; /* the directory we are searching */ - int docache; /* == 0 do not cache last component */ int wantparent; /* 1 => wantparent or lockparent flag */ int rdonly; /* lookup read-only flag bit */ int error = 0; @@ -721,10 +722,6 @@ relookup(dvp, vpp, cnp) * Setup: break out flag bits into variables. */ wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT); - docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; - if (cnp->cn_nameiop == DELETE || - (wantparent && cnp->cn_nameiop != CREATE)) - docache = 0; rdonly = cnp->cn_flags & RDONLY; cnp->cn_flags &= ~ISSYMLINK; dp = dvp; |