cvs commit: src/sys/fs/nullfs null_vnops.c

Suleiman Souhlal ssouhlal at FreeBSD.org
Sat Sep 3 00:23:47 PDT 2005


Hi,

On Sep 3, 2005, at 3:48 AM, Jeff Roberson wrote:
> I'm not sure that this is correct.  The line:
> lockmgr(vnlock, LK_RELEASE, NULL, curthread);
>
> Should unlock the lower node which vput would have already  
> unlocked.  It must be done this way to properly adjust the vnlock ptr.

I'm not sure I understand what you're saying. After this commit, the  
code is:
         vnlock = vp->v_vnlock;
         vp->v_vnlock = &vp->v_lock;
         lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, curthread);
         if (lowervp) {
                 vput(lowervp);
         } else
                 lockmgr(vnlock, LK_RELEASE, NULL, curthread);
Which I believe unlocks things in the right order.

However, after discussing with kan@, we identified two races:
     - There is a short time between changing the pointer and locking  
vp->v_lock during which someone might steal the lock from us, so we  
should hold the interlock during these two operations.
     - Someone might be waiting on the lower vnode's lock, and when  
it is released, he might think that he has the vnode. I am unsure how  
this can be fixed.

--
Suleiman Souhlal     | ssouhlal at vt.edu
The FreeBSD Project  | ssouhlal at FreeBSD.org



More information about the cvs-src mailing list