From owner-p4-projects@FreeBSD.ORG Wed Mar 28 18:03:57 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 6BD8316A409; Wed, 28 Mar 2007 18:03:57 +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 30D1816A401 for ; Wed, 28 Mar 2007 18:03:57 +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 2174113C46A for ; Wed, 28 Mar 2007 18:03:57 +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 l2SI3vkM016041 for ; Wed, 28 Mar 2007 18:03:57 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l2SI3u28016029 for perforce@freebsd.org; Wed, 28 Mar 2007 18:03:56 GMT (envelope-from scottl@freebsd.org) Date: Wed, 28 Mar 2007 18:03:56 GMT Message-Id: <200703281803.l2SI3u28016029@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 116755 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: Wed, 28 Mar 2007 18:03:57 -0000 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,