Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata Mark a buffer with EIO in wdstrategy() if the de...



details:   https://anonhg.NetBSD.org/src/rev/cdcee92effe3
branches:  trunk
changeset: 758476:cdcee92effe3
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Nov 05 15:49:37 2010 +0000

description:
Mark a buffer with EIO in wdstrategy() if the device is not "enabled"
(more like "present"), not if it is merely asleep.

If the device is not awake, get out of wdstart() right away.

Brett Lymn and KAMADA Ken'ichi report that this stops the kernel from
crashing after a suspend/resume cycle.

diffstat:

 sys/dev/ata/wd.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 9546a7090f33 -r cdcee92effe3 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Fri Nov 05 14:43:56 2010 +0000
+++ b/sys/dev/ata/wd.c  Fri Nov 05 15:49:37 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.384 2010/02/24 22:37:57 dyoung Exp $ */
+/*     $NetBSD: wd.c,v 1.385 2010/11/05 15:49:37 dyoung 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.384 2010/02/24 22:37:57 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.385 2010/11/05 15:49:37 dyoung Exp $");
 
 #include "opt_ata.h"
 
@@ -489,9 +489,10 @@
        }
 
        /* If device invalidated (e.g. media change, door open,
-        * device suspension), then error.
+        * device detachment), then error.
         */
-       if ((wd->sc_flags & WDF_LOADED) == 0 || !device_is_active(wd->sc_dev)) {
+       if ((wd->sc_flags & WDF_LOADED) == 0 ||
+           !device_is_enabled(wd->sc_dev)) {
                bp->b_error = EIO;
                goto done;
        }
@@ -573,6 +574,10 @@
 
        ATADEBUG_PRINT(("wdstart %s\n", device_xname(wd->sc_dev)),
            DEBUG_XFERS);
+
+       if (!device_is_active(wd->sc_dev))
+               return;
+
        while (wd->openings > 0) {
 
                /* Is there a buf for us ? */



Home | Main Index | Thread Index | Old Index