0003-Fix-race-condition-on-cam-simqueue.patch

masterblaster, 07/04/2011 10:08 AM

Download (1.2 KB)

View differences:

sys/bus/cam/cam_xpt.c
7230 7230
	cam_simq_t queue;
7231 7231
	struct cam_sim *sim;
7232 7232

  
7233
	spin_lock(&cam_simq_spin);
7234 7233
	TAILQ_INIT(&queue);
7234
	spin_lock(&cam_simq_spin);
7235 7235

  
7236 7236
    while (!TAILQ_EMPTY(&cam_simq)) {
7237 7237
        TAILQ_CONCAT(&queue, &cam_simq, links);
7238 7238
        spin_unlock(&cam_simq_spin);
7239 7239

  
7240 7240
        while ((sim = TAILQ_FIRST(&queue)) != NULL) {
7241
            TAILQ_REMOVE(&queue, sim, links);
7242 7241
            CAM_SIM_LOCK(sim);
7242
            TAILQ_REMOVE(&queue, sim, links);
7243 7243
            sim->flags &= ~CAM_SIM_ON_DONEQ;
7244 7244
            camisr_runqueue(sim);
7245 7245
            CAM_SIM_UNLOCK(sim);
7246
-