Fix obscure bug in namei(), which was the cause of PR 7306.
The problem is that if "sl" is a symbolic link, a lookup on "sl/" will be flagged as the last component. Thus VOP_LOOKUP will lock the parent directory if LOCKPARENT is set. In order for the symbolic link to be resolved, this lock needs to be released. namei() would test for this by checking if ni_pathlen == 1, which it wouldn't as "/" is left in the name, and namei() would not unlock the parent. The next call to lookup() to resolve the symbolic link would fail as the parent was still locked.
This commit is contained in:
parent
8775e52947
commit
2e1fa90ecb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_lookup.c,v 1.28 1998/08/04 04:03:19 perry Exp $ */
|
||||
/* $NetBSD: vfs_lookup.c,v 1.29 1999/04/07 05:47:37 wrstuden Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -164,7 +164,7 @@ namei(ndp)
|
||||
cnp->cn_flags |= HASBUF;
|
||||
return (0);
|
||||
}
|
||||
if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1)
|
||||
if ((cnp->cn_flags & LOCKPARENT) && (cnp->cn_flags & ISLASTCN))
|
||||
VOP_UNLOCK(ndp->ni_dvp, 0);
|
||||
if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
|
||||
error = ELOOP;
|
||||
|
Loading…
Reference in New Issue
Block a user