From owner-p4-projects@FreeBSD.ORG Thu Apr 12 16:53:44 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6FEC616A406; Thu, 12 Apr 2007 16:53:44 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4193916A400 for ; Thu, 12 Apr 2007 16:53:44 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 2E86713C43E for ; Thu, 12 Apr 2007 16:53:44 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l3CGriFe061371 for ; Thu, 12 Apr 2007 16:53:44 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l3CGrh3Q061367 for perforce@freebsd.org; Thu, 12 Apr 2007 16:53:43 GMT (envelope-from scottl@freebsd.org) Date: Thu, 12 Apr 2007 16:53:43 GMT Message-Id: <200704121653.l3CGrh3Q061367@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 117967 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2007 16:53:44 -0000 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;