From owner-p4-projects@FreeBSD.ORG Tue Mar 27 04:08:13 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 83F7516A406; Tue, 27 Mar 2007 04:08:13 +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 341FB16A404 for ; Tue, 27 Mar 2007 04:08:13 +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 22BAE13C45D for ; Tue, 27 Mar 2007 04:08:13 +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 l2R48Dkc015498 for ; Tue, 27 Mar 2007 04:08:13 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l2R48CBK015495 for perforce@freebsd.org; Tue, 27 Mar 2007 04:08:12 GMT (envelope-from scottl@freebsd.org) Date: Tue, 27 Mar 2007 04:08:12 GMT Message-Id: <200703270408.l2R48CBK015495@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 116622 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: Tue, 27 Mar 2007 04:08:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=116622 Change 116622 by scottl@scottl-x64 on 2007/03/27 04:07:44 Don't let the periph be removed while the sysctl registration task is still running. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#10 edit .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#26 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#10 (text+ko) ==== @@ -572,8 +572,10 @@ char tmpstr[80], tmpstr2[80]; periph = (struct cam_periph *)context; + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return; + softc = (struct cd_softc *)periph->softc; - snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number); snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); @@ -588,6 +590,7 @@ if (softc->sysctl_tree == NULL) { printf("cdsysctlinit: unable to allocate sysctl tree\n"); mtx_unlock(&Giant); + cam_periph_release(periph); return; } @@ -601,6 +604,7 @@ "Minimum CDB size"); mtx_unlock(&Giant); + cam_periph_release(periph); } /* ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#26 (text+ko) ==== @@ -1009,8 +1009,10 @@ char tmpstr[80], tmpstr2[80]; periph = (struct cam_periph *)context; + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return; + softc = (struct da_softc *)periph->softc; - snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number); snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); @@ -1023,6 +1025,7 @@ if (softc->sysctl_tree == NULL) { printf("dasysctlinit: unable to allocate sysctl tree\n"); mtx_unlock(&Giant); + cam_periph_release(periph); return; } @@ -1036,6 +1039,7 @@ "Minimum CDB size"); mtx_unlock(&Giant); + cam_periph_release(periph); } static int