panic after removing usb flash drive

Bernd Walter ticso at cicely12.cicely.de
Wed Aug 31 17:47:26 GMT 2005


On Wed, Aug 31, 2005 at 09:38:20AM -0600, Scott Long wrote:
> Ben Kaduk wrote:
> >On 8/31/05, Kyle Brooks <captinsmock at 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 at bwct.de                                  info at bwct.de



More information about the freebsd-current mailing list