Subject: Re: Use vn_rdwr in vnd (Re: kern/34882)
To: None <jmmv@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: netbsd-bugs
Date: 11/09/2006 23:05:02
The following reply was made to PR kern/34882; it has been noted by GNATS.

From: "Julio M. Merino Vidal" <jmmv84@gmail.com>
To: "YAMAMOTO Takashi" <yamt@mwd.biglobe.ne.jp>
Cc: tech-kern@netbsd.org, gnats-bugs@NetBSD.org
Subject: Re: Use vn_rdwr in vnd (Re: kern/34882)
Date: Fri, 10 Nov 2006 00:00:39 +0100

 On 11/9/06, YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> wrote:
 > > +     /* Flush the vnode if requested. */
 > > +     if (obp->b_flags & B_VFLUSH)
 > > +             vflushbuf(vp, 0);
 > > +
 > > +     /* We need to increase the number of outputs on the vnode if
 > > +      * there was any write to it (either due to a real write or due
 > > +      * to a flush). */
 > > +     if (!doread || obp->b_flags & B_VFLUSH)
 > > +             vp->v_numoutput++;
 >
 > can you explain these B_VFLUSH handling?
 
 For the first part I just tried to flush the vnode.  I don't remember
 how I ended exactly in vflushbuf, but it *seemed* reasonable...
 Hmm... maybe one ought to call VOP_FSYNC instead?  (And maybe this
 handles the case below too.)
 
 Aside that, the driver was getting read requests that had the B_VFLUSH
 bit active. Later on a "neg numoutput" panic happened which I was able
 to fix by incrementing v_numoutput.  Yes, that looks extremely ugly
 (at least to me) so, please, if you have any better idea on how to fix
 it tell me and I'll take a look.
 
 Thanks.
 
 -- 
 Julio M. Merino Vidal <jmmv84@gmail.com>
 The Julipedia - http://julipedia.blogspot.com/