From owner-svn-src-head@FreeBSD.ORG Sun Dec 21 07:22:46 2008 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 D9EB21065670; Sun, 21 Dec 2008 07:22:46 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id 8D3478FC08; Sun, 21 Dec 2008 07:22:46 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.21.166] (helo=devil.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1LEIe3-0002VT-Dc; Sun, 21 Dec 2008 15:22:35 +0800 Message-ID: <494DEEC4.4010902@micom.mng.net> Date: Sun, 21 Dec 2008 15:22:44 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.17 (X11/20081020) MIME-Version: 1.0 To: Scott Long References: <200812210620.mBL6KBUC025421@svn.freebsd.org> In-Reply-To: <200812210620.mBL6KBUC025421@svn.freebsd.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186371 - 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, 21 Dec 2008 07:22:47 -0000 Scott Long wrote: > Author: scottl > Date: Sun Dec 21 06:20:11 2008 > New Revision: 186371 > URL: http://svn.freebsd.org/changeset/base/186371 > > Log: > Fix refcount locking in cd, pass, and sg periphs. > > Modified: > head/sys/cam/scsi/scsi_cd.c > head/sys/cam/scsi/scsi_pass.c > head/sys/cam/scsi/scsi_sg.c > > Modified: head/sys/cam/scsi/scsi_cd.c > ============================================================================== > --- head/sys/cam/scsi/scsi_cd.c Sun Dec 21 04:40:02 2008 (r186370) > +++ head/sys/cam/scsi/scsi_cd.c Sun Dec 21 06:20:11 2008 (r186371) > @@ -996,12 +996,6 @@ cdopen(struct disk *dp) > return (error); > } > > - /* Closes aren't symmetrical with opens, so fix up the refcounting. */ > - if (softc->flags & CD_FLAG_OPEN) > - cam_periph_release(periph); > - else > - softc->flags |= CD_FLAG_OPEN; > - > /* > * Check for media, and set the appropriate flags. We don't bail > * if we don't have media, but then we don't allow anything but the > @@ -1011,7 +1005,15 @@ cdopen(struct disk *dp) > > CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); > cam_periph_unhold(periph); > - cam_periph_unlock(periph); > + > + /* Closes aren't symmetrical with opens, so fix up the refcounting. */ > + if ((softc->flags & CD_FLAG_OPEN) == 0) { > + softc->flags |= CD_FLAG_OPEN; > + cam_periph_unlock(periph); > + } else { > + cam_periph_unlock(periph); > + cam_periph_release(periph); > + } > > return (0); > } > > Modified: head/sys/cam/scsi/scsi_pass.c > ============================================================================== > --- head/sys/cam/scsi/scsi_pass.c Sun Dec 21 04:40:02 2008 (r186370) > +++ head/sys/cam/scsi/scsi_pass.c Sun Dec 21 06:20:11 2008 (r186371) > @@ -346,13 +346,13 @@ passopen(struct cdev *dev, int flags, in > > if ((softc->flags & PASS_FLAG_OPEN) == 0) { > softc->flags |= PASS_FLAG_OPEN; > + cam_periph_unlock(periph); > } else { > /* Device closes aren't symmertical, so fix up the refcount */ > + cam_periph_unlock(periph); > cam_periph_release(periph); > } > > - cam_periph_unlock(periph); > - > return (error); > } > > > Modified: head/sys/cam/scsi/scsi_sg.c > ============================================================================== > --- head/sys/cam/scsi/scsi_sg.c Sun Dec 21 04:40:02 2008 (r186370) > +++ head/sys/cam/scsi/scsi_sg.c Sun Dec 21 06:20:11 2008 (r186371) > @@ -399,13 +399,13 @@ sgopen(struct cdev *dev, int flags, int > > if ((softc->flags & SG_FLAG_OPEN) == 0) { > softc->flags |= SG_FLAG_OPEN; > + cam_periph_unlock(periph); > } else { > /* Device closes aren't symmetrical, fix up the refcount. */ > + cam_periph_unlock(periph); > cam_periph_release(periph); > } > > - cam_periph_unlock(periph); > - > return (error); > } > > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > Thanks a lot. Ganbold > > -- Writing is easy; all you do is sit staring at the blank sheet of paper until drops of blood form on your forehead. -- Gene Fowler