summaryrefslogtreecommitdiffstats
path: root/sys/cam/ata
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-03-29 07:50:47 +0000
committermav <mav@FreeBSD.org>2013-03-29 07:50:47 +0000
commit28542ab068b603bcf920294d2f8b85555c63e3f5 (patch)
tree1c58c974d24dafaf2e13f376b91d6ad71cb7754f /sys/cam/ata
parentbecc1654f847d6f865b8d4cce27427568b720c93 (diff)
downloadFreeBSD-src-28542ab068b603bcf920294d2f8b85555c63e3f5.zip
FreeBSD-src-28542ab068b603bcf920294d2f8b85555c63e3f5.tar.gz
Implement CAM_PERIPH_FOREACH() macro, safely iterating over the list of
driver's periphs, acquiring and releaseing periph references while doing it. Use it to iterate over the lists of ada and da periphs when flushing caches and putting devices to sleep on shutdown and suspend. Previous code could panic in theory if some device disappear in the middle of the process.
Diffstat (limited to 'sys/cam/ata')
-rw-r--r--sys/cam/ata/ata_da.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index c700e7c..e929e51 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -1835,7 +1835,7 @@ adaflush(void)
struct ada_softc *softc;
int error;
- TAILQ_FOREACH(periph, &adadriver.units, unit_links) {
+ CAM_PERIPH_FOREACH(periph, &adadriver) {
union ccb ccb;
/* If we paniced with lock held - not recurse here. */
@@ -1889,7 +1889,7 @@ adaspindown(uint8_t cmd, int flags)
struct ada_softc *softc;
int error;
- TAILQ_FOREACH(periph, &adadriver.units, unit_links) {
+ CAM_PERIPH_FOREACH(periph, &adadriver) {
union ccb ccb;
/* If we paniced with lock held - not recurse here. */
@@ -1962,7 +1962,7 @@ adaresume(void *arg)
if (ada_spindown_suspend == 0)
return;
- TAILQ_FOREACH(periph, &adadriver.units, unit_links) {
+ CAM_PERIPH_FOREACH(periph, &adadriver) {
cam_periph_lock(periph);
softc = (struct ada_softc *)periph->softc;
/*
OpenPOWER on IntegriCloud