Subject: Re: Use vn_rdwr in vnd (Re: kern/34882)
To: YAMAMOTO Takashi <>
From: Julio M. Merino Vidal <>
List: tech-kern
Date: 11/11/2006 09:38:56
On 11/11/06, YAMAMOTO Takashi <> wrote:
> > On 11/10/06, YAMAMOTO Takashi <> wrote:
> > > > On 11/9/06, YAMAMOTO Takashi <> wrote:
> > > why do you want to flush the underlying vnode here at all?
> > > if you want to preserve stable storage semantics or such,
> > > it should be done regardless of B_VFLUSH.
> >
> > Because in the non-rw case, B_VFLUSH is passed down to the disk driver
> > and I guess that this will do a sync, isn't it?
> what's "non-rw case"?

As I said, a read with a flush.  But see below.

> > > i don't know how read requests with B_VFLUSH happens
> >
> > Just try a newfs over the vnd device and you'll get into
> > handle_with_rw with B_READ and B_VFLUSH set.
> i tried the following with the attached patch, but got no panics.
>                 mount_tmpfs a /mnt
>                 cd /mnt
>                 dd if=/dev/zero of=x bs=1m count=1
>                 vnconfig vnd0 x
>                 newfs -F /dev/rvnd0d

Of course not because that's what the increment of numoutput is for
(or was supposed to be for).

> > I checked other drivers and they seem to do similar things.  See
> > ccd.c:770.  Oh, and now I see there is a V_INCR_NUMOUTPUT macro to do
> > this, although it is not always used.  It is also preceded by a
> > "useful" comment.
> they are for !B_READ requests, aren't they?

Hmm, interesting... I've changed this:

	if (!doread || obp->b_flags & B_VFLUSH)

to this:

	printf("%s, %s\n", doread ? "read" : "write",
	    obp->b_flags & B_VFLUSH ? "flush" : "noflush");
	if (!doread)

And it does not panic.  I'm sure it did before!  And I'm sure I got
"read, sync" messages from the debug printf.  (But maybe it was
because I still had some other problem somewhere in the handling of

So... should I remove all the B_VFLUSH handling from the function?
Should I change the manual v_numoutput increment to use the

Thank you.

Julio M. Merino Vidal <>
The Julipedia -