From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 10 09:57:49 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5ED3E106564A; Fri, 10 Jun 2011 09:57:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44CF18FC0A; Fri, 10 Jun 2011 09:57:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5A9vn3i020586; Fri, 10 Jun 2011 09:57:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5A9vnZ9020583; Fri, 10 Jun 2011 09:57:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106100957.p5A9vnZ9020583@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Jun 2011 09:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222924 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 09:57:49 -0000 Author: mav Date: Fri Jun 10 09:57:48 2011 New Revision: 222924 URL: http://svn.freebsd.org/changeset/base/222924 Log: MFC r220686 (by jh): Move TUNABLE_INT_FETCH() out of the SIM lock to avoid sleeping while holding the lock. The fix is analogous to r220618 for ada(4). Modified: stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Fri Jun 10 09:54:48 2011 (r222923) +++ stable/8/sys/cam/scsi/scsi_cd.c Fri Jun 10 09:57:48 2011 (r222924) @@ -687,6 +687,8 @@ cdregister(struct cam_periph *periph, vo else softc->minimum_command_size = 6; + (void)cam_periph_hold(periph, PRIBIO); + cam_periph_unlock(periph); /* * Load the user's default, if any. */ @@ -712,7 +714,6 @@ cdregister(struct cam_periph *periph, vo * 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, @@ -736,6 +737,7 @@ cdregister(struct cam_periph *periph, vo softc->disk->d_flags = 0; disk_create(softc->disk, DISK_VERSION); cam_periph_lock(periph); + cam_periph_unhold(periph); /* * Add an async callback so that we get Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Fri Jun 10 09:54:48 2011 (r222923) +++ stable/8/sys/cam/scsi/scsi_da.c Fri Jun 10 09:57:48 2011 (r222924) @@ -1205,35 +1205,6 @@ daregister(struct cam_periph *periph, vo TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph); /* - * RBC devices don't have to support READ(6), only READ(10). - */ - if (softc->quirks & DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) - softc->minimum_cmd_size = 10; - else - softc->minimum_cmd_size = 6; - - /* - * Load the user's default, if any. - */ - snprintf(tmpstr, sizeof(tmpstr), "kern.cam.da.%d.minimum_cmd_size", - periph->unit_number); - TUNABLE_INT_FETCH(tmpstr, &softc->minimum_cmd_size); - - /* - * 6, 10, 12 and 16 are the currently permissible values. - */ - if (softc->minimum_cmd_size < 6) - softc->minimum_cmd_size = 6; - else if ((softc->minimum_cmd_size > 6) - && (softc->minimum_cmd_size <= 10)) - softc->minimum_cmd_size = 10; - else if ((softc->minimum_cmd_size > 10) - && (softc->minimum_cmd_size <= 12)) - softc->minimum_cmd_size = 12; - else if (softc->minimum_cmd_size > 12) - softc->minimum_cmd_size = 16; - - /* * Register this media as a disk */ @@ -1265,6 +1236,35 @@ daregister(struct cam_periph *periph, vo dasendorderedtag, softc); mtx_unlock(periph->sim->mtx); + /* + * RBC devices don't have to support READ(6), only READ(10). + */ + if (softc->quirks & DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) + softc->minimum_cmd_size = 10; + else + softc->minimum_cmd_size = 6; + + /* + * Load the user's default, if any. + */ + snprintf(tmpstr, sizeof(tmpstr), "kern.cam.da.%d.minimum_cmd_size", + periph->unit_number); + TUNABLE_INT_FETCH(tmpstr, &softc->minimum_cmd_size); + + /* + * 6, 10, 12 and 16 are the currently permissible values. + */ + if (softc->minimum_cmd_size < 6) + softc->minimum_cmd_size = 6; + else if ((softc->minimum_cmd_size > 6) + && (softc->minimum_cmd_size <= 10)) + softc->minimum_cmd_size = 10; + else if ((softc->minimum_cmd_size > 10) + && (softc->minimum_cmd_size <= 12)) + softc->minimum_cmd_size = 12; + else if (softc->minimum_cmd_size > 12) + softc->minimum_cmd_size = 16; + softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, periph->unit_number, 0,