Date: Thu, 12 Apr 2007 16:53:43 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 117967 for review Message-ID: <200704121653.l3CGrh3Q061367@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=117967 Change 117967 by scottl@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704121653.l3CGrh3Q061367>