Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dev/ata Pull up revision 1.393 (requested by bouyer i...



details:   https://anonhg.NetBSD.org/src/rev/4760379bcd3f
branches:  netbsd-6
changeset: 774287:4760379bcd3f
user:      jdc <jdc%NetBSD.org@localhost>
date:      Tue Jul 03 21:13:25 2012 +0000

description:
Pull up revision 1.393 (requested by bouyer in ticket #381).

In some case, when an error is reported by the disk, the ahci controller
still reports a number of bytes transfered equal to bcount.
This then triggers a KASSERT in physio_biodone:
        if (done == todo)
                KASSERT(bp->b_error == 0);
Detect this case in wd(4) (so that the workaround works for other controllers
too if they have the same issue, or if the issue is with the drive)
and claim we didn't read/write anything.

diffstat:

 sys/dev/ata/wd.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r cb86a5f030d2 -r 4760379bcd3f sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Tue Jul 03 20:48:40 2012 +0000
+++ b/sys/dev/ata/wd.c  Tue Jul 03 21:13:25 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $ */
+/*     $NetBSD: wd.c,v 1.392.2.1 2012/07/03 21:13:25 jdc Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.392.2.1 2012/07/03 21:13:25 jdc Exp $");
 
 #include "opt_ata.h"
 
@@ -819,6 +819,14 @@
                bp->b_error = EIO;
                break;
        }
+       if (__predict_false(bp->b_error != 0) && bp->b_resid == 0) {
+               /*
+                * the disk or controller sometimes report a complete
+                * xfer, when there has been an error. This is wrong,
+                * assume nothing got transfered in this case
+                */
+               bp->b_resid = bp->b_bcount;
+       }
        disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid),
            (bp->b_flags & B_READ));
        rnd_add_uint32(&wd->rnd_source, bp->b_blkno);



Home | Main Index | Thread Index | Old Index