From owner-svn-src-head@FreeBSD.ORG Thu Jun 21 09:51:51 2012 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 41393106566B; Thu, 21 Jun 2012 09:51:51 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 11E818FC29; Thu, 21 Jun 2012 09:51:49 +0000 (UTC) Received: by lbon10 with SMTP id n10so2339427lbo.13 for ; Thu, 21 Jun 2012 02:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=G5lQGJRTWb3baTo6RU58Pp/+W5dJ5vHccjZoucXeABI=; b=cl5phq0m5kt6rM97YGSv0ur3YNv6FsE59mvUh6a9duIH8PPiUgdyH967t924KwT+qG DcbiaGaaM5d/+Bvq4DABKUrTYpp0FaRmGM1BgQyURDYKgkoK1lsir0+rIV0P1zmL/J8P GrQOy4sa2cK+7GtSajYAtEPkLOjcebJkVOBw3Fxre48kjP+77VWxYffBlBbCiB2lGbKG 5KLBGvcxPtdiu+k0vqPuDU3j8S1fvRCKcNSk1GDnNNJ/og5ae13e+TsD1UlfISEoxcXa /9NjemziRSAVWAFwlnp8eqrYUYvMI3tYpV750zHQsFJI0OZ7q8z1CQp84m7j0P0UL+tQ TSxA== Received: by 10.112.24.194 with SMTP id w2mr11348720lbf.75.1340272308897; Thu, 21 Jun 2012 02:51:48 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id p2sm18202725lbj.4.2012.06.21.02.51.43 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 02:51:44 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FE2EEAD.3070706@FreeBSD.org> Date: Thu, 21 Jun 2012 12:51:41 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sergey Kandaurov References: <201206201825.q5KIPpjQ060916@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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:51:51 -0000 On 06/21/12 12:30, Sergey Kandaurov wrote: > 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: >> Check status of cam_periph_hold() inside cdclose(). If cd device was >> invalidated while open, cam_periph_hold() will return error and won't >> get the reference. Following reference release will crash the system. >> >> Sponsored by: iXsystems, Inc. >> MFC after: 3 days >> >> Modified: >> head/sys/cam/scsi/scsi_cd.c >> >> Modified: head/sys/cam/scsi/scsi_cd.c >> ============================================================================== >> --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 (r237334) >> +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 (r237335) >> @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp) >> { >> struct cam_periph *periph; >> struct cd_softc *softc; >> + int error; >> >> periph = (struct cam_periph *)dp->d_drv1; >> if (periph == NULL) >> @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp) >> softc = (struct cd_softc *)periph->softc; >> >> cam_periph_lock(periph); >> - cam_periph_hold(periph, PRIBIO); >> + if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { >> + cam_periph_unlock(periph); >> + cam_periph_release(periph); >> + return (0); >> + } >> >> CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, >> ("cdclose\n")); > > Does it fix the reported crash with cd refcount underflow? It seems so. > http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html Yes, I think it should. At least diagnostics looks very alike. -- Alexander Motin