David Laight <da...@l8s.co.uk> wrote:

> > Solution is to test for vp->v_vflag & VV_ROOT and unlock the vnode
> > before calling vn_open or namei, and relocking it afterwards.
> Is that valid - I assume the root vnode is locked for a reason,
> you can't just unlock it because a routine you need to call wants
> to lock it again.

Here is the code path:
 
sys_extattr_set_file
    extattr_set_vp
        vn_lock
        VOP_SETEXTATTR
            ufs_setextattr
                ufs_extattr_set
                    ufs_extattr_autocreate_attr
                        *** VOP_UNLOCK added here ***
                        namei
                           VFS_ROOT
                                vn_lock
                                VOP_UNLOCK
                        *** vn_lock added here ***
        VOP_UNLOCK
   vrele

I wonder if there is room for a race condition. What can happen to the
root vnode of a filesystem that would ruin my day here? At least I
assume it cannot be removed.
  
-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
m...@netbsd.org

Reply via email to