From b00aeda6f05e55a0ebe2804c1bad37f7a20d9e6d Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Mon, 9 Oct 2000 19:54:54 +0000 Subject: [PATCH] Close a race condition that doesn't really exist in -current. When a resource shortage occurs, freeze our queue and then set the resource shortage flag while the controller data structure is locked. The old code did these in the wrong order potentially allowing our interrupt handler to release the queue and clear the flag before the freeze ever occurred. --- sys/dev/aic7xxx/aic7xxx_freebsd.c | 2 +- sys/dev/aic7xxx/aic7xxx_osm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/aic7xxx/aic7xxx_freebsd.c b/sys/dev/aic7xxx/aic7xxx_freebsd.c index 04d83b936e9e..eb5650856358 100644 --- a/sys/dev/aic7xxx/aic7xxx_freebsd.c +++ b/sys/dev/aic7xxx/aic7xxx_freebsd.c @@ -433,9 +433,9 @@ ahc_action(struct cam_sim *sim, union ccb *ccb) ahc_lock(ahc, &s); if ((scb = ahc_get_scb(ahc)) == NULL) { + xpt_freeze_simq(sim, /*count*/1); ahc->flags |= AHC_RESOURCE_SHORTAGE; ahc_unlock(ahc, &s); - xpt_freeze_simq(sim, /*count*/1); ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_done(ccb); return; diff --git a/sys/dev/aic7xxx/aic7xxx_osm.c b/sys/dev/aic7xxx/aic7xxx_osm.c index 04d83b936e9e..eb5650856358 100644 --- a/sys/dev/aic7xxx/aic7xxx_osm.c +++ b/sys/dev/aic7xxx/aic7xxx_osm.c @@ -433,9 +433,9 @@ ahc_action(struct cam_sim *sim, union ccb *ccb) ahc_lock(ahc, &s); if ((scb = ahc_get_scb(ahc)) == NULL) { + xpt_freeze_simq(sim, /*count*/1); ahc->flags |= AHC_RESOURCE_SHORTAGE; ahc_unlock(ahc, &s); - xpt_freeze_simq(sim, /*count*/1); ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_done(ccb); return;