From owner-svn-src-head@FreeBSD.ORG Sun Jun 26 01:32:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91610106564A; Sun, 26 Jun 2011 01:32:47 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 819738FC13; Sun, 26 Jun 2011 01:32:47 +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 p5Q1WlTY030789; Sun, 26 Jun 2011 01:32:47 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5Q1Wlrw030787; Sun, 26 Jun 2011 01:32:47 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201106260132.p5Q1Wlrw030787@svn.freebsd.org> From: "Justin T. Gibbs" Date: Sun, 26 Jun 2011 01:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223557 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2011 01:32:47 -0000 Author: gibbs Date: Sun Jun 26 01:32:46 2011 New Revision: 223557 URL: http://svn.freebsd.org/changeset/base/223557 Log: cam/scsi/scsi_cd.c: In cdregister(), hold the periph lock semaphore during changer probe/configuration. This removes a window where an open of the cd device may succeed before probe processing has completed. Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Sun Jun 26 01:14:54 2011 (r223556) +++ head/sys/cam/scsi/scsi_cd.c Sun Jun 26 01:32:46 2011 (r223557) @@ -687,6 +687,10 @@ cdregister(struct cam_periph *periph, vo else softc->minimum_command_size = 6; + /* + * Refcount and block open attempts until we are setup + * Can't block + */ (void)cam_periph_hold(periph, PRIBIO); cam_periph_unlock(periph); /* @@ -747,7 +751,6 @@ cdregister(struct cam_periph *periph, vo softc->disk->d_hba_subdevice = cpi.hba_subdevice; disk_create(softc->disk, DISK_VERSION); cam_periph_lock(periph); - cam_periph_unhold(periph); /* * Add an async callback so that we get @@ -972,12 +975,6 @@ cdregister(struct cam_periph *periph, vo cdregisterexit: - /* - * Refcount and block open attempts until we are setup - * Can't block - */ - (void)cam_periph_hold(periph, PRIBIO); - if ((softc->flags & CD_FLAG_CHANGER) == 0) xpt_schedule(periph, CAM_PRIORITY_DEV); else