When killing pending xfers on device detach, we can't expect scsipi_done

to remove all xfers from the pending queue.  It removes only xfers for
asynchronous transactions.  So, simply loop over all pending xfers
with calling scsipi_done and wait xfers to drain.  Addresses PR#9703.
This commit is contained in:
enami 2000-04-03 03:37:33 +00:00
parent 7782859d5b
commit c560e9a77b
2 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi_base.c,v 1.72 2000/03/17 11:45:50 soren Exp $ */
/* $NetBSD: scsi_base.c,v 1.73 2000/04/03 03:37:33 enami Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -164,9 +164,15 @@ void
scsi_kill_pending(sc_link)
struct scsipi_link *sc_link;
{
struct scsipi_xfer *xs;
struct scsipi_xfer *xs, *xs_next;
while ((xs = TAILQ_FIRST(&sc_link->pending_xfers)) != NULL) {
/*
* Note that the scsipi_done frees a xfer only if it is
* an asynchronous transaction.
*/
for (xs = TAILQ_FIRST(&sc_link->pending_xfers); xs != NULL;
xs = xs_next) {
xs_next = TAILQ_NEXT(xs, device_q);
xs->xs_status |= XS_STS_DONE;
xs->error = XS_DRIVER_STUFFUP;
scsipi_done(xs);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.33 2000/04/03 01:40:51 enami Exp $ */
/* $NetBSD: scsipi_base.c,v 1.34 2000/04/03 03:37:34 enami Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -204,10 +204,7 @@ scsipi_kill_pending(sc_link)
{
(*sc_link->scsipi_kill_pending)(sc_link);
#ifdef DIAGNOSTIC
if (TAILQ_FIRST(&sc_link->pending_xfers) != NULL)
panic("scsipi_kill_pending");
#endif
scsipi_wait_drain(sc_link);
}
/*