NetBSD-Bugs archive

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

Re: kern/38643: [dM] st tape drive loses data



The following reply was made to PR kern/38643; it has been noted by GNATS.

From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
To: David Holland <dholland-bugs%NetBSD.org@localhost>
Cc: Havard Eidnes <he%NetBSD.org@localhost>, gnats-bugs%NetBSD.org@localhost,
        mouse%Rodents.Montreal.QC.CA@localhost, 
kern-bug-people%NetBSD.org@localhost,
        gnats-admin%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost, 
yamt%NetBSD.org@localhost
Subject: Re: kern/38643: [dM] st tape drive loses data
Date: Mon, 1 Sep 2008 22:22:20 +0200

 On Mon, Sep 01, 2008 at 06:41:36PM +0000, David Holland wrote:
 > On Mon, Sep 01, 2008 at 08:06:58PM +0200, Havard Eidnes wrote:
 >  > I don't have any suggestions for a fix, but I may have an
 >  > observation (which I'm sure you've thought of yourself as well,
 >  > but it's good to have it written down anyway).
 > 
 > I think I've found the problem, and if so this is the fix:
 > 
 > Index: st.c
 > ===================================================================
 > RCS file: /cvsroot/src/sys/dev/scsipi/st.c,v
 > retrieving revision 1.205
 > diff -u -p -r1.205 st.c
 > --- st.c     8 Jun 2008 18:18:34 -0000       1.205
 > +++ st.c     1 Sep 2008 18:24:12 -0000
 > @@ -1125,7 +1125,7 @@ done:
 >      /*
 >       * Correctly set the buf to indicate a completed xfer
 >       */
 > -    bp->b_resid = bp->b_bcount;
 > +    bp->b_resid = 0;
 >      biodone(bp);
 >      return;
 >  }
 
 This is wrong; This code is used in error path (b_error is not 0), and
 for the case (bp->b_bcount == 0). When b_error is not 0, bp->b_resid
 has to be equal to bp->b_bcount or a KASSERT will be triggered later.
 
 I think the code here does what's intended, but maybe the comment is
 misleading.
 
 -- 
 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
      NetBSD: 26 ans d'experience feront toujours la difference
 --
 


Home | Main Index | Thread Index | Old Index