From owner-freebsd-current@FreeBSD.ORG Wed Aug 31 17:47:26 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7F53216A41F for ; Wed, 31 Aug 2005 17:47:26 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8E3E43D48 for ; Wed, 31 Aug 2005 17:47:25 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [10.1.1.7]) (authenticated bits=0) by srv1.cosmo-project.de (8.12.10/8.12.10) with ESMTP id j7VHlGBS038209 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Wed, 31 Aug 2005 19:47:18 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [10.1.1.14]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id j7VHkaKi004717 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Aug 2005 19:46:37 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id j7VHkaMG011919; Wed, 31 Aug 2005 19:46:36 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id j7VHkWHs011918; Wed, 31 Aug 2005 19:46:32 +0200 (CEST) (envelope-from ticso) Date: Wed, 31 Aug 2005 19:46:31 +0200 From: Bernd Walter To: Scott Long Message-ID: <20050831174631.GE37930@cicely12.cicely.de> References: <1125452228.740.3.camel@arbitor.homelinux.com> <47d0403c05083020044f6ac0be@mail.gmail.com> <4315CEEC.80100@samsco.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4315CEEC.80100@samsco.org> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.9i Cc: freebsd-current@freebsd.org, Kyle Brooks , Ben Kaduk Subject: Re: panic after removing usb flash drive X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2005 17:47:26 -0000 On Wed, Aug 31, 2005 at 09:38:20AM -0600, Scott Long wrote: > Ben Kaduk wrote: > >On 8/31/05, Kyle Brooks wrote: > 1) When the thumbdrive gets pulled, the umass driver gets told to > detach. It tries to detach itself from CAM, but things don't get torn > down correctly because there is an open reference to the target in CAM > (because there is a mounted filesystem on the device). umass truddles > along anyways and goes away, leaving lots of dangling pointers in CAM > that blow up on the next attempted I/O access. > > Part of the problem here is that the umass driver is architected wrong. > It creates a SIM, bus, and target instance for every umass device that > gets inserted. When the device gets pulled, it tries to tear down > each of those instances all at once. CAM simply wasn't designed for > this. It was designed for the SIMs and buses to be long-lived objects > where only the targets (and luns) come and go. Making umass fit this > model would invlove turning it into two logical drivers. One would be > a SIM that would attach to the root hub instance of each USB controller > and would treat the USB bus as a CAM bus. The other would be a target > driver that gets created and destroyed on a per-device basis as those > devices come and go. When a umass device gets plugged in, the USB > framework would tell the apprpriate SIM to create a target instance. > When the device gets pulled, the framework would tell the SIM to detach > and destroy the target. No dangling pointers would be left behind by > the SIM going away. I have some prototype work in progress on this. This would really a step backward. Originally we had LUN creation/deletion on shared SIM and lots of different problems. SIM deletion should really be fixed - not only for umass, but generally as we live in a world with removeable cards. Technically a shared sim with using targets could be made work for umass as it's defined today, but it won't work for USB to SCSI converters - that we don't support one of these adapters today doesn't solve the problem. Is is a academical standpoint defining where in the USB/umass infrastrukture the SIM is located, but I personally always saw it inside the USB-device and not on the USB. USB is just a transport medium and not a SIM in the same way as PCI is just a transport medium for a classical SCSI-Interface. Yes - umass creates a SIM, bus and targed, because that is what a user really attaches/detaches. > In any case, the panic posted in the grandparent message implicates CAM > and umass, which is what I would expect. There may be more layers of > problems underneath it. Possible, but lets solve them. -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de