- 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.
This commit is contained in:
parent
e4fefa9bd5
commit
ea9aa09dd1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user