tech-kern archive

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

Re: vfs question



On Wed, Mar 14, 2018 at 01:06:53PM +0000, coypu%sdf.org@localhost wrote:
> Hi I am looking at code related to PR 53096 (really important please
> look at it too), I came across this code, in vfs_vnode.c vrelel:
> 
> 
>     732 		mutex_exit(vp->v_interlock);
>     733 		error = vn_lock(vp,
>     734 		    LK_EXCLUSIVE | LK_RETRY | (force ? 0 : LK_NOWAIT));
>     735 		defer = (error != 0);
>     736 		mutex_enter(vp->v_interlock);
> 
> Is this pattern of code legal? it looks like we are dropping all
> locks, then making a reference to vp again (even dereferencing it), and
> it might have been nuked from low orbit (freed) since we last had
> guarantees about it.
> 
> Am I missing something?

When we get these, usecount is 1, so nothing else should have a reference
to this vnode, and nothing else will free it.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index