Project

General

Profile

Bug #2092 » 0003-Fix-race-condition-on-cam-simqueue.patch

masterblaster, 07/04/2011 10:08 AM

View differences:

sys/bus/cam/cam_xpt.c
cam_simq_t queue;
struct cam_sim *sim;
spin_lock(&cam_simq_spin);
TAILQ_INIT(&queue);
spin_lock(&cam_simq_spin);
while (!TAILQ_EMPTY(&cam_simq)) {
TAILQ_CONCAT(&queue, &cam_simq, links);
spin_unlock(&cam_simq_spin);
while ((sim = TAILQ_FIRST(&queue)) != NULL) {
TAILQ_REMOVE(&queue, sim, links);
CAM_SIM_LOCK(sim);
TAILQ_REMOVE(&queue, sim, links);
sim->flags &= ~CAM_SIM_ON_DONEQ;
camisr_runqueue(sim);
CAM_SIM_UNLOCK(sim);
(3-3/3)