Source-Changes-HG archive

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

[src/trunk]: src/sys/kern In bdev_strategy, return ENXIO instead of panicing ...



details:   https://anonhg.NetBSD.org/src/rev/0ead8a4bde91
branches:  trunk
changeset: 747120:0ead8a4bde91
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 03 11:42:21 2009 +0000

description:
In bdev_strategy, return ENXIO instead of panicing if the block device has
disappeared. ok pooka@

diffstat:

 sys/kern/subr_devsw.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 4c77a28b1326 -r 0ead8a4bde91 sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Thu Sep 03 11:22:05 2009 +0000
+++ b/sys/kern/subr_devsw.c     Thu Sep 03 11:42:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.27 2009/08/18 02:44:37 yamt Exp $     */
+/*     $NetBSD: subr_devsw.c,v 1.28 2009/09/03 11:42:21 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.27 2009/08/18 02:44:37 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.28 2009/09/03 11:42:21 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -733,8 +733,12 @@
        const struct bdevsw *d;
        int mpflag;
 
-       if ((d = bdevsw_lookup(bp->b_dev)) == NULL)
-               panic("bdev_strategy");
+       if ((d = bdevsw_lookup(bp->b_dev)) == NULL) {
+               bp->b_error = ENXIO;
+               bp->b_resid = bp->b_bcount;
+               biodone(bp);
+               return;
+       }
 
        DEV_LOCK(d);
        (*d->d_strategy)(bp);



Home | Main Index | Thread Index | Old Index