summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_cd.c
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2011-06-26 01:32:46 +0000
committergibbs <gibbs@FreeBSD.org>2011-06-26 01:32:46 +0000
commit59e398752aa5192e2f984e4cdd08479f181c9d18 (patch)
tree1f870cde5d0db2c49ede0ae7454476c56664f3d4 /sys/cam/scsi/scsi_cd.c
parent1152c6dddc834f1d787357656082b676b62a4523 (diff)
downloadFreeBSD-src-59e398752aa5192e2f984e4cdd08479f181c9d18.zip
FreeBSD-src-59e398752aa5192e2f984e4cdd08479f181c9d18.tar.gz
cam/scsi/scsi_cd.c:
In cdregister(), hold the periph lock semaphore during changer probe/configuration. This removes a window where an open of the cd device may succeed before probe processing has completed.
Diffstat (limited to 'sys/cam/scsi/scsi_cd.c')
-rw-r--r--sys/cam/scsi/scsi_cd.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index c1951ff..91384b7 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -687,6 +687,10 @@ cdregister(struct cam_periph *periph, void *arg)
else
softc->minimum_command_size = 6;
+ /*
+ * Refcount and block open attempts until we are setup
+ * Can't block
+ */
(void)cam_periph_hold(periph, PRIBIO);
cam_periph_unlock(periph);
/*
@@ -747,7 +751,6 @@ cdregister(struct cam_periph *periph, void *arg)
softc->disk->d_hba_subdevice = cpi.hba_subdevice;
disk_create(softc->disk, DISK_VERSION);
cam_periph_lock(periph);
- cam_periph_unhold(periph);
/*
* Add an async callback so that we get
@@ -972,12 +975,6 @@ cdregister(struct cam_periph *periph, void *arg)
cdregisterexit:
- /*
- * Refcount and block open attempts until we are setup
- * Can't block
- */
- (void)cam_periph_hold(periph, PRIBIO);
-
if ((softc->flags & CD_FLAG_CHANGER) == 0)
xpt_schedule(periph, CAM_PRIORITY_DEV);
else
OpenPOWER on IntegriCloud