Subject: Re: VOP locking issue
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Antti Kantee <pooka@cs.hut.fi>
List: tech-kern
Date: 11/13/2006 22:46:23
[let's try to include the list this time]

On Sun Nov 12 2006 at 22:33:38 +0100, Manuel Bouyer wrote:
> This maps to this code in xbdback_xenbus.c (with error handling removed for
> better reading)
> 	err = bdevvp(xbdi->xbdi_dev, &xbdi->xbdi_vp);
>         err  = VOP_OPEN(xbdi->xbdi_vp, FREAD, NOCRED, 0);
> 	VOP_UNLOCK(xbdi->xbdi_vp, 0); 
> 
> I suspect the block device opened here was also open in userland 
> (by the qemu-dm process). It's also possible that it was mounted.
> Does anyone have an idea if this is the problem, and if it can be avoided ?

My theory: I suspect that checkalias() matches in bdevvp(), so you
get a vnode which actually supports locking (pure specfs does not).
Now, bdevvp() returns an unlocked vnode, so you should call vn_lock()
before calling VOP_OPEN() to be correct.

-- 
Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
    "la qualité la plus indispensable du cuisinier est l'exactitude"