Index: sys/cam/cam_xpt.c =================================================================== --- sys/cam/cam_xpt.c +++ sys/cam/cam_xpt.c @@ -174,7 +174,6 @@ struct cam_doneq { struct mtx_padalign cam_doneq_mtx; STAILQ_HEAD(, ccb_hdr) cam_doneq; - int cam_doneq_sleep; }; static struct cam_doneq cam_doneqs[MAXCPU]; @@ -4648,12 +4647,12 @@ done_ccb->ccb_h.target_lun) % cam_num_doneqs; queue = &cam_doneqs[hash]; mtx_lock(&queue->cam_doneq_mtx); - run = (queue->cam_doneq_sleep && STAILQ_EMPTY(&queue->cam_doneq)); + run = STAILQ_EMPTY(&queue->cam_doneq); STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - mtx_unlock(&queue->cam_doneq_mtx); if (run) wakeup(&queue->cam_doneq); + mtx_unlock(&queue->cam_doneq_mtx); } void @@ -5529,12 +5528,9 @@ STAILQ_INIT(&doneq); mtx_lock(&queue->cam_doneq_mtx); while (1) { - while (STAILQ_EMPTY(&queue->cam_doneq)) { - queue->cam_doneq_sleep = 1; + while (STAILQ_EMPTY(&queue->cam_doneq)) msleep(&queue->cam_doneq, &queue->cam_doneq_mtx, PRIBIO, "-", 0); - queue->cam_doneq_sleep = 0; - } STAILQ_CONCAT(&doneq, &queue->cam_doneq); mtx_unlock(&queue->cam_doneq_mtx);