Improve error paths in (e)siop_scsipi_request():
- When terminating the adapter request after the cmd has been removed from the free list, put that cmd back on the free list before returing. - Correctly indicate which bus_dma_load() failed. Analysis and fix from Michael L. Hitch in PR/42844.
This commit is contained in:
parent
b8cca62afb
commit
295766de32
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: esiop.c,v 1.51 2010/03/11 04:00:36 mrg Exp $ */
|
/* $NetBSD: esiop.c,v 1.52 2010/04/09 19:25:52 jakllsch Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Manuel Bouyer.
|
* Copyright (c) 2002 Manuel Bouyer.
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.51 2010/03/11 04:00:36 mrg Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.52 2010/04/09 19:25:52 jakllsch Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -1533,6 +1533,8 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
target);
|
target);
|
||||||
xs->error = XS_RESOURCE_SHORTAGE;
|
xs->error = XS_RESOURCE_SHORTAGE;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
esiop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1560,6 +1562,8 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
target, lun);
|
target, lun);
|
||||||
xs->error = XS_RESOURCE_SHORTAGE;
|
xs->error = XS_RESOURCE_SHORTAGE;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
esiop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1577,8 +1581,11 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
aprint_error_dev(sc->sc_c.sc_dev,
|
aprint_error_dev(sc->sc_c.sc_dev,
|
||||||
"unable to load cmd DMA map: %d\n",
|
"unable to load cmd DMA map: %d\n",
|
||||||
error);
|
error);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = (error == EAGAIN) ?
|
||||||
|
XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
esiop_cmd->cmd_c.status = CMDST_FREE;
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list, esiop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1590,12 +1597,16 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
BUS_DMA_READ : BUS_DMA_WRITE));
|
BUS_DMA_READ : BUS_DMA_WRITE));
|
||||||
if (error) {
|
if (error) {
|
||||||
aprint_error_dev(sc->sc_c.sc_dev,
|
aprint_error_dev(sc->sc_c.sc_dev,
|
||||||
"unable to load cmd DMA map: %d",
|
"unable to load data DMA map: %d",
|
||||||
error);
|
error);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = (error == EAGAIN) ?
|
||||||
|
XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
bus_dmamap_unload(sc->sc_c.sc_dmat,
|
bus_dmamap_unload(sc->sc_c.sc_dmat,
|
||||||
esiop_cmd->cmd_c.dmamap_cmd);
|
esiop_cmd->cmd_c.dmamap_cmd);
|
||||||
|
esiop_cmd->cmd_c.status = CMDST_FREE;
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
esiop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: siop.c,v 1.94 2009/10/19 18:41:13 bouyer Exp $ */
|
/* $NetBSD: siop.c,v 1.95 2010/04/09 19:25:52 jakllsch Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 Manuel Bouyer.
|
* Copyright (c) 2000 Manuel Bouyer.
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.94 2009/10/19 18:41:13 bouyer Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.95 2010/04/09 19:25:52 jakllsch Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -1275,6 +1275,8 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
"target %d\n", target);
|
"target %d\n", target);
|
||||||
xs->error = XS_RESOURCE_SHORTAGE;
|
xs->error = XS_RESOURCE_SHORTAGE;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
siop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1295,6 +1297,8 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
target);
|
target);
|
||||||
xs->error = XS_RESOURCE_SHORTAGE;
|
xs->error = XS_RESOURCE_SHORTAGE;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
siop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1313,6 +1317,8 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
target, lun);
|
target, lun);
|
||||||
xs->error = XS_RESOURCE_SHORTAGE;
|
xs->error = XS_RESOURCE_SHORTAGE;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
siop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1330,8 +1336,11 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
aprint_error_dev(sc->sc_c.sc_dev,
|
aprint_error_dev(sc->sc_c.sc_dev,
|
||||||
"unable to load cmd DMA map: %d\n",
|
"unable to load cmd DMA map: %d\n",
|
||||||
error);
|
error);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = (error == EAGAIN) ?
|
||||||
|
XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
|
siop_cmd->cmd_c.status = CMDST_FREE;
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list, siop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1343,12 +1352,16 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||||
BUS_DMA_READ : BUS_DMA_WRITE));
|
BUS_DMA_READ : BUS_DMA_WRITE));
|
||||||
if (error) {
|
if (error) {
|
||||||
aprint_error_dev(sc->sc_c.sc_dev,
|
aprint_error_dev(sc->sc_c.sc_dev,
|
||||||
"unable to load cmd DMA map: %d",
|
"unable to load data DMA map: %d",
|
||||||
error);
|
error);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = (error == EAGAIN) ?
|
||||||
|
XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
|
||||||
scsipi_done(xs);
|
scsipi_done(xs);
|
||||||
bus_dmamap_unload(sc->sc_c.sc_dmat,
|
bus_dmamap_unload(sc->sc_c.sc_dmat,
|
||||||
siop_cmd->cmd_c.dmamap_cmd);
|
siop_cmd->cmd_c.dmamap_cmd);
|
||||||
|
siop_cmd->cmd_c.status = CMDST_FREE;
|
||||||
|
TAILQ_INSERT_TAIL(&sc->free_list,
|
||||||
|
siop_cmd, next);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue