From owner-svn-src-head@FreeBSD.ORG Thu Jun 21 09:30:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 183FB106566B; Thu, 21 Jun 2012 09:30:19 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8BBA78FC1A; Thu, 21 Jun 2012 09:30:18 +0000 (UTC) Received: by ggnm2 with SMTP id m2so308698ggn.13 for ; Thu, 21 Jun 2012 02:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=12ePM4cyRtxN5auL9eBXav9cj5LJhvL60wjlg9RG2rs=; b=HF0rRGFmwfA8kTZei1ozvEbhaZ37mvwVu/5o1P4tfWdtSMzdtZIioon5X8ie1fbVmm 0DfHIfG6vayoFDr7e7xwJpp0+s1dzMc0TyGcOzaDBD69BHKYkb7wqpWf3DomySyGB4gV oVeuoloiZr6Ol8XrHNDJ05jsQvbCJpT+5o8edHwYrsCA94XM6gkUUwccv4DU0wNum1VK fEt1DWobYfG6ssQIW8X0sK1jQmnskUdf96kNRY6HsdkxqBHos8El3NgIIcLTBl7NDr3Z xwuqXDt27nvQaZKj+OZ2hqRGyO2ysPD8IwuM/6MPbr9Yof6sdmLdmIvgBYnSru5Zs3A+ 3geQ== MIME-Version: 1.0 Received: by 10.50.149.134 with SMTP id ua6mr6780069igb.11.1340271017717; Thu, 21 Jun 2012 02:30:17 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.64.8.170 with HTTP; Thu, 21 Jun 2012 02:30:17 -0700 (PDT) In-Reply-To: <201206201825.q5KIPpjQ060916@svn.freebsd.org> References: <201206201825.q5KIPpjQ060916@svn.freebsd.org> Date: Thu, 21 Jun 2012 13:30:17 +0400 X-Google-Sender-Auth: fMHJ8rxJwhYRJj07F0LJqvArTxc Message-ID: From: Sergey Kandaurov To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Oliver Fromme Subject: Re: svn commit: r237335 - 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: Thu, 21 Jun 2012 09:30:19 -0000 On 20 June 2012 22:25, Alexander Motin wrote: > Author: mav > Date: Wed Jun 20 18:25:51 2012 > New Revision: 237335 > URL: http://svn.freebsd.org/changeset/base/237335 > > Log: > =A0Check status of cam_periph_hold() inside cdclose(). =A0If cd device wa= s > =A0invalidated while open, cam_periph_hold() will return error and won't > =A0get the reference. =A0Following reference release will crash the syste= m. > > =A0Sponsored by: iXsystems, Inc. > =A0MFC after: =A0 =A03 days > > Modified: > =A0head/sys/cam/scsi/scsi_cd.c > > Modified: head/sys/cam/scsi/scsi_cd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 =A0 =A0 =A0 =A0(= r237334) > +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 =A0 =A0 =A0 =A0(= r237335) > @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp) > =A0{ > =A0 =A0 =A0 =A0struct =A0cam_periph *periph; > =A0 =A0 =A0 =A0struct =A0cd_softc *softc; > + =A0 =A0 =A0 int error; > > =A0 =A0 =A0 =A0periph =3D (struct cam_periph *)dp->d_drv1; > =A0 =A0 =A0 =A0if (periph =3D=3D NULL) > @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp) > =A0 =A0 =A0 =A0softc =3D (struct cd_softc *)periph->softc; > > =A0 =A0 =A0 =A0cam_periph_lock(periph); > - =A0 =A0 =A0 cam_periph_hold(periph, PRIBIO); > + =A0 =A0 =A0 if ((error =3D cam_periph_hold(periph, PRIBIO)) !=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_unlock(periph); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_release(periph); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); > + =A0 =A0 =A0 } > > =A0 =A0 =A0 =A0CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH= , > =A0 =A0 =A0 =A0 =A0 =A0("cdclose\n")); Hi. Does it fix the reported crash with cd refcount underflow? It seems so. http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html --=20 wbr, pluknet