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 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;

This has been this way ~forever, and AFAIK it's always been wrong, but
changes in kern_physio before 4.0 have changed the resulting behavior
so that it could easily be consistent with the observed phenomena.

There's also another maybe related issue: line 413 of kern_physio.c
1.87 has
        /* uio->uio_offset = ps->ps_endoffset; */

which yamt added, commented out, when cleaning up some grossness prior
to 4.0. I am pretty sure it's why part of the data is getting skipped
over, and I think it should be uncommented. yamt?

On the other hand, I could be completely wrong here too...

David A. Holland

Home | Main Index | Thread Index | Old Index