Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2007 18:03:56 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 116755 for review
Message-ID:  <200703281803.l2SI3u28016029@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116755

Change 116755 by scottl@scottl-x64 on 2007/03/28 18:03:15

	Work around malloc locking constraints.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#15 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#15 (text+ko) ====

@@ -725,6 +725,7 @@
 	 * WORM peripheral driver.  WORM drives will also have the WORM
 	 * driver attached to them.
 	 */
+	cam_periph_unlock(periph);
 	softc->disk = disk_alloc();
 	softc->disk->d_devstat = devstat_new_entry("cd", 
 			  periph->unit_number, 0,
@@ -740,6 +741,7 @@
 	softc->disk->d_drv1 = periph;
 	softc->disk->d_flags = 0;
 	disk_create(softc->disk, DISK_VERSION);
+	cam_periph_lock(periph);
 
 	/*
 	 * Add an async callback so that we get
@@ -1358,7 +1360,8 @@
 				softc->changer->flags |= CHANGER_MANUAL_CALL;
 				cdrunchangerqueue(softc->changer);
 			} else
-				tsleep(&softc->changer, PRIBIO, "cgticb", 0);
+				msleep(&softc->changer, periph->sim->mtx,
+				    PRIBIO, "cgticb", 0);
 		}
 	}
 	return(cam_periph_getccb(periph, priority));
@@ -2885,8 +2888,11 @@
              
 	ccb = cdgetccb(periph, /* priority */ 1);
 
+	/* XXX Should be M_WAITOK */
 	rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), 
-			  M_TEMP, M_WAITOK);
+			  M_TEMP, M_NOWAIT);
+	if (rcap_buf == NULL)
+		return (ENOMEM);
 
 	scsi_read_capacity(&ccb->csio, 
 			   /*retries*/ 1,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703281803.l2SI3u28016029>