Subject: kern/8708: crash dump to sd device does not work
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 10/29/1999 15:57:42
>Number:         8708
>Category:       kern
>Synopsis:       crash dump to sd device does not work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 29 15:57:01 1999
>Last-Modified:
>Originator:     Izumi Tsutsui
>Organization:
Izumi Tsutsui	Himeji City, Japan
>Release:        NetBSD-current 1.4L 19991015
>Environment:
System: NetBSD/i386 1.4L, but maybe on all arch

>Description:
Kernel crash dump to sd device could not be created by ENODEV error.

>How-To-Repeat:
# reboot -d
[...snip...]
syncing disks... 7 7 2 done

dumping to dev 13,1 offset 51262
dump error 19
rebooting...

>Fix:
Check sd->sd_dev.dv_flags after it's assigned
in /sys/dev/scsipi/sd.c:sddump().

--- sd.c.orig	Sun Oct 17 20:18:59 1999
+++ sd.c	Sat Oct 30 07:30:25 1999
@@ -1205,9 +1205,6 @@
 	struct scsipi_xfer *xs;	/* ... convenience */
 	int	retval;
 
-	if ((sd->sc_dev.dv_flags & DVF_ACTIVE) == 0)
-		return (ENODEV);
-
 	/* Check if recursive dump; if so, punt. */
 	if (sddoingadump)
 		return (EFAULT);
@@ -1221,6 +1218,9 @@
 	/* Check for acceptable drive number. */
 	if (unit >= sd_cd.cd_ndevs || (sd = sd_cd.cd_devs[unit]) == NULL)
 		return (ENXIO);
+
+	if ((sd->sc_dev.dv_flags & DVF_ACTIVE) == 0)
+		return (ENODEV);
 
 	/* Make sure it was initialized. */
 	if ((sd->sc_link->flags & SDEV_MEDIA_LOADED) != SDEV_MEDIA_LOADED)
>Audit-Trail:
>Unformatted: