kernel - lock sim in cam_periph_alloc()
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 25 Aug 2010 04:02:54 +0000 (21:02 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 25 Aug 2010 04:02:54 +0000 (21:02 -0700)
* cam_periph_alloc() is called from places where the sim lock is not
  being held.  Acquire the lock internally as needed.

sys/bus/cam/cam_periph.c

index 2571643..412d91b 100644 (file)
@@ -170,6 +170,7 @@ cam_periph_alloc(periph_ctor_t *periph_ctor,
        xpt_unlock_buses();
 
        sim = xpt_path_sim(path);
+       CAM_SIM_LOCK(sim);
        path_id = xpt_path_path_id(path);
        target_id = xpt_path_target_id(path);
        lun_id = xpt_path_lun_id(path);
@@ -237,6 +238,7 @@ failure:
        default:
                panic("cam_periph_alloc: Unknown init level");
        }
+       CAM_SIM_UNLOCK(sim);
        return(status);
 }