tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: extended attributes (need help)



On Mon, Jun 13, 2011 at 10:25:21AM +0200, Emmanuel Dreyfus wrote:
> Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> 
> > The patch I posted yesterday has a race condition, if a user process 
> > quickly sets two attributes on two different filesystems, then the second
> > one will panic on VFS_ROOT() in namei() because the root vnode is already
> > locked. 
> 
> That analysis of the problem was wrong. The problem occured when setting
> an attribute on the root vnode. In that case, the root vnode is locked
> when entering ufs_extattr_autocreate_attr(), and calling vn_open() or
> namei() cause a call to VFS_ROOT, which attempts to lock the already
> locked vnode.
> 
> 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.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index