From 1cae51fe36206b42d2dfbed75d7ebe2f72a9094c Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Thu, 7 Jan 2010 00:11:16 +0000 Subject: warn if scsi_done has been called twice on an xs in the scsi_xs_sync path rather than panic. ok krw@ --- sys/scsi/scsi_base.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 9164833a213..d0614255c39 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.151 2010/01/04 11:46:17 dlg Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.152 2010/01/07 00:11:15 dlg Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -808,6 +808,14 @@ scsi_xs_sync_done(struct scsi_xfer *xs) { struct mutex *cookie = xs->cookie; + if (cookie == NULL) { +#ifdef DIAGNOSTIC + sc_print_addr(xs->sc_link); + printf("scsi_done already called on xs(%p)\n", xs); +#endif + return; + } + mtx_enter(cookie); xs->cookie = NULL; if (!ISSET(xs->flags, SCSI_NOSLEEP)) -- cgit v1.2.3