Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Aug 2005 19:46:31 +0200
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        Scott Long <scottl@samsco.org>
Cc:        freebsd-current@freebsd.org, Kyle Brooks <captinsmock@columbus.rr.com>, Ben Kaduk <minimarmot@gmail.com>
Subject:   Re: panic after removing usb flash drive
Message-ID:  <20050831174631.GE37930@cicely12.cicely.de>
In-Reply-To: <4315CEEC.80100@samsco.org>
References:  <1125452228.740.3.camel@arbitor.homelinux.com> <47d0403c05083020044f6ac0be@mail.gmail.com> <4315CEEC.80100@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 31, 2005 at 09:38:20AM -0600, Scott Long wrote:
> Ben Kaduk wrote:
> >On 8/31/05, Kyle Brooks <captinsmock@columbus.rr.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050831174631.GE37930>