Module Name:    src
Committed By:   jmcneill
Date:           Thu Sep  3 11:42:21 UTC 2009

Modified Files:
        src/sys/kern: subr_devsw.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/kern/subr_devsw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.27 src/sys/kern/subr_devsw.c:1.28
--- src/sys/kern/subr_devsw.c:1.27	Tue Aug 18 02:44:37 2009
+++ src/sys/kern/subr_devsw.c	Thu Sep  3 11:42:21 2009
@@ -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);

Reply via email to