Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_target.c 167082 2007-02-27 17:15:39Z jhb $");
---
> __FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_target.c 168752 2007-04-15 08:49:19Z scottl $");
49a50
> #include <cam/cam_sim.h>
163c164,168
< /* Create softc and initialize it. Only one proc can open each targ device. */
---
> /*
> * Create softc and initialize it. Only one proc can open each targ device.
> * There is no locking here because a periph doesn't get created until an
> * ioctl is issued to do so, and that can't happen until this method returns.
> */
201a207
> struct cam_periph *periph;
204a211,224
> if ((softc->periph == NULL) ||
> (softc->state & TARG_STATE_LUN_ENABLED) == 0) {
> destroy_dev(dev);
> FREE(softc, M_TARG);
> return (0);
> }
>
> /*
> * Acquire a hold on the periph so that it doesn't go away before
> * we are ready at the end of the function.
> */
> periph = softc->periph;
> cam_periph_acquire(periph);
> cam_periph_lock(periph);
214a235,237
> cam_periph_unlock(periph);
> cam_periph_release(periph);
>
231a255
> struct cam_sim *sim;
234,237c258,261
< status = xpt_create_path(&path, /*periph*/NULL,
< new_lun->path_id,
< new_lun->target_id,
< new_lun->lun_id);
---
> status = xpt_create_path_unlocked(&path, /*periph*/NULL,
> new_lun->path_id,
> new_lun->target_id,
> new_lun->lun_id);
241a266,267
> sim = xpt_path_sim(path);
> mtx_lock(sim->mtx);
244a271
> mtx_unlock(sim->mtx);
247a275,279
> if (softc->periph == NULL) {
> status = CAM_DEV_NOT_THERE;
> break;
> }
> cam_periph_lock(softc->periph);
248a281
> cam_periph_unlock(softc->periph);
254a288,292
> /* If no periph available, disallow debugging changes */
> if ((softc->state & TARG_STATE_LUN_ENABLED) == 0) {
> status = CAM_DEV_NOT_THERE;
> break;
> }
259a298
> cam_periph_lock(softc->periph);
264,268d302
< /* If no periph available, disallow debugging changes */
< if ((softc->state & TARG_STATE_LUN_ENABLED) == 0) {
< status = CAM_DEV_NOT_THERE;
< break;
< }
269a304
> cam_periph_unlock(softc->periph);
296a332
> cam_periph_lock(softc->periph);
300a337
> cam_periph_unlock(softc->periph);
337a375
> cam_periph_lock(softc->periph);
339a378
> cam_periph_unlock(softc->periph);
534a574
> cam_periph_lock(softc->periph);
544a585
> cam_periph_unlock(softc->periph);
546a588
> cam_periph_lock(softc->periph);
571a614
> cam_periph_unlock(softc->periph);
799,800d841
< mtx_lock(&Giant);
<
808a850
> cam_periph_lock(softc->periph);
813c855
< error = tsleep(user_queue,
---
> error = msleep(user_queue, softc->periph->sim->mtx,
825c867
< mtx_unlock(&Giant);
---
> cam_periph_unlock(softc->periph);
843a886
> cam_periph_unlock(softc->periph);
844a888
> cam_periph_lock(softc->periph);
861a906
> cam_periph_unlock(softc->periph);
862a908
> cam_periph_lock(softc->periph);
879c925
< mtx_unlock(&Giant);
---
> cam_periph_unlock(softc->periph);
1007a1054
> struct cam_sim *sim;
1040c1087,1088
< tsleep(&softc->pending_ccb_queue,
---
> sim = xpt_path_sim(softc->path);
> msleep(&softc->pending_ccb_queue, sim->mtx,