diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-28 13:56:56 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-28 13:56:56 +0000 |
commit | ea9aa09dd1f91de923dedae70ae2aa3386390b78 (patch) | |
tree | d4dea0acc4bc4b5e61b11d040dd8caaf4b408bfc /sys/kern/vfs_lookup.c | |
parent | e4fefa9bd573a3b3fffff847a87ab4ad7a2a9098 (diff) | |
download | src-ea9aa09dd1f91de923dedae70ae2aa3386390b78.tar.gz src-ea9aa09dd1f91de923dedae70ae2aa3386390b78.zip |
- 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.
Notes
Notes:
svn path=/head/; revision=144229
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-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 6596eb99a692..6b8b8064bc16 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; |