Subject: Re: Possible VOP_LOOKUP() interface change
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Charles M. Hannum <root@ihack.net>
List: tech-kern
Date: 09/03/1999 18:53:14
You clearly don't understand what I'm talking about.  Effectively,
lookup would do something equivalent to:

if ((cnp->cn_flags & ISLASTCN) == 0) {
	cnp->cn_nameiop = LOOKUP;
	cnp->cn_flags &= ~(LOCKPARENT|WANTPARENT);
}

Then all of the tests like:

        if ((flags & ISLASTCN) && (vdp->v_mount->mnt_flag & MNT_RDONLY) && 
            (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))

                        if (!error && lockparent && (flags & ISLASTCN))

                        if (!lockparent || error || !(flags & ISLASTCN))

                        if (lockparent && pdp != vdp && (flags & ISLASTCN))

        if ((nameiop == CREATE || nameiop == RENAME) &&
            (flags & ISLASTCN)) {

        if ((nameiop == CREATE || nameiop == RENAME ||
             (nameiop == DELETE &&
              (ap->a_cnp->cn_flags & DOWHITEOUT) &&
              (ap->a_cnp->cn_flags & ISWHITEOUT))) &&  
            (flags & ISLASTCN) && dp->i_ffs_nlink != 0) {

        if (nameiop == DELETE && (flags & ISLASTCN)) {

        if (nameiop == RENAME && wantparent && (flags & ISLASTCN)) {

                if (lockparent && (flags & ISLASTCN) &&

                if (!lockparent || !(flags & ISLASTCN))

would not need to test ISLASTCN.

Amusingly, there's even a bug related to this right now.  In
cache_lookup(), we have:

                if (cnp->cn_nameiop != CREATE) {

With the current interface, this should test ISLASTCN.  The effect of
not doing so is that negative hits on intermediate directories are
ignored (and force a linear search of the entire parent directory)
during a create operation.