Subject: Re: VOP locking issue
To: Antti Kantee <email@example.com>
From: Manuel Bouyer <firstname.lastname@example.org>
Date: 11/13/2006 23:04:40
On Mon, Nov 13, 2006 at 10:46:23PM +0200, Antti Kantee wrote:
> 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.
Thanks. But what does lock the vnode in my case then ? Or would VOP_UNLOCK()
not complain if it's called on an unlocked vnode ? Note that the above
code works most of the time; I've got only one report of failure.
Manuel Bouyer <email@example.com>
NetBSD: 26 ans d'experience feront toujours la difference