PERFORCE change 117967 for review

Scott Long scottl at FreeBSD.org
Thu Apr 12 16:53:44 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=117967

Change 117967 by scottl at scottl-y1 on 2007/04/12 16:53:21

	Drop the sim lock when calling cam_periph_mapmem().  This is needed
	because of the possibility of sleeping and triggering I/O from VM
	and proc methods that get called.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#22 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sg.c#4 edit

Differences ...

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

@@ -567,7 +567,14 @@
 
 		bzero(&mapinfo, sizeof(mapinfo));
 
+		/*
+		 * cam_periph_mapmem calls into proc and vm functions that can
+		 * sleep as well as trigger I/O, so we can't hold the lock.
+		 * Dropping it here is reasonably safe.
+		 */
+		cam_periph_unlock(periph);
 		error = cam_periph_mapmem(ccb, &mapinfo); 
+		cam_periph_lock(periph);
 
 		/*
 		 * cam_periph_mapmem returned an error, we can't continue.

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

@@ -891,7 +891,15 @@
 	if (((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE)
 	    && (ccb->csio.data_ptr != NULL)) {
 		bzero(&mapinfo, sizeof(mapinfo));
+
+		/*
+		 * cam_periph_mapmem calls into proc and vm functions that can
+		 * sleep as well as trigger I/O, so we can't hold the lock.
+		 * Dropping it here is reasonably safe.
+		 */
+		cam_periph_unlock(periph);
 		error = cam_periph_mapmem(ccb, &mapinfo);
+		cam_periph_lock(periph);
 		if (error)
 			return (error);
 		need_unmap = 1;


More information about the p4-projects mailing list