From owner-svn-src-all@FreeBSD.ORG Thu May 21 15:11:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8811A1065705; Thu, 21 May 2009 15:11:05 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5F30D8FC18; Thu, 21 May 2009 15:11:05 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 04A2C46B49; Thu, 21 May 2009 11:11:05 -0400 (EDT) Date: Thu, 21 May 2009 16:11:04 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: John Baldwin In-Reply-To: <200905210942.35555.jhb@freebsd.org> Message-ID: References: <200905211322.n4LDM73t067924@svn.freebsd.org> <20090521132641.GJ1927@deviant.kiev.zoral.com.ua> <3bbf2fe10905210629p46c7a204v6863aaba77354462@mail.gmail.com> <200905210942.35555.jhb@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Attilio Rao , Kostik Belousov , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r192535 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 15:11:06 -0000 On Thu, 21 May 2009, John Baldwin wrote: >>>> Move the M_WAITOK flag in notify() into an M_NOWAIT one in order to > match >>>> the behaviour alredy present with the further malloc() call in >>>> devctl_notify(). >>>> This fixes a bug in the CAM layer where the camisr handler finished to >>>> call camperiphfree() (and subsequently destroy_dev() resulting in a new >>>> dev notify) while the xpt lock is held. >>> This is wrong. You cannot call destroy_dev() while holding any mutex. >>> Taking this into account, it makes no sense to use M_NOWAIT in notify(). >> >> As long as devctl_notify() also calls M_NOWAIT and if not available skips >> "silently" it just does the same thing, I think this approach is more >> consistent. >> >> It remains, though, the fact to fix CAM when calling destroy_dev(). Maybe >> we should add a witness_warn() there? > > I agree with kib, this should be reverted and CAM fixed instead. I also > agree that M_NOWAIT use should be limited where possible. devctl_notify() probably needs to grow a sleepable flag, or perhaps we need two variations, one that can sleep. Robert N M Watson Computer Laboratory University of Cambridge