From owner-p4-projects@FreeBSD.ORG Thu Oct 15 12:16:04 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B495D1065676; Thu, 15 Oct 2009 12:16:04 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7907A1065670 for ; Thu, 15 Oct 2009 12:16:04 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 66CB58FC17 for ; Thu, 15 Oct 2009 12:16:04 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FCG4aY005951 for ; Thu, 15 Oct 2009 12:16:04 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n9FCG4F6005949 for perforce@freebsd.org; Thu, 15 Oct 2009 12:16:04 GMT (envelope-from mav@freebsd.org) Date: Thu, 15 Oct 2009 12:16:04 GMT Message-Id: <200910151216.n9FCG4F6005949@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 169516 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 12:16:05 -0000 http://p4web.freebsd.org/chv.cgi?CH=169516 Change 169516 by mav@mav_mavtest on 2009/10/15 12:15:49 Use only cam_periph_acquire() instead of cam_periph_hold() on init and device reset async. We can't sleep in async handler. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#29 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#29 (text+ko) ==== @@ -555,13 +555,16 @@ { struct ada_softc *softc = (struct ada_softc *)periph->softc; + cam_periph_async(periph, code, path, arg); + if (softc->state != ADA_STATE_NORMAL) + break; /* * Restore device configuration. */ softc->state = ADA_STATE_SET_MULTI; - (void)cam_periph_hold(periph, PRIBIO); + cam_periph_acquire(periph); xpt_schedule(periph, CAM_PRIORITY_DEV); - /* FALLTHROUGH*/ + break; } default: cam_periph_async(periph, code, path, arg); @@ -737,7 +740,7 @@ * to finish the probe. The reference will be dropped in adadone at * the end of probe. */ - (void)cam_periph_hold(periph, PRIBIO); + cam_periph_acquire(periph); xpt_schedule(periph, CAM_PRIORITY_DEV); /* @@ -1020,7 +1023,11 @@ * operation. */ xpt_release_ccb(done_ccb); - cam_periph_unhold(periph); + if (bioq_first(&softc->bio_queue) != NULL) { + /* Have more work to do, so ensure we stay scheduled */ + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + cam_periph_release_locked(periph); return; } case ADA_CCB_DUMP: