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



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