From: Mike Anderson <andmike@us.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Alberto Bertogli <albertogli@telpin.com.ar>,
USB development list <linux-usb-devel@lists.sourceforge.net>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [linux-usb-devel] BUG when removing USB flash drive
Date: Fri, 14 May 2004 09:59:56 -0700 [thread overview]
Message-ID: <20040514165956.GA8122@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0405141105060.4524-100000@ida.rowland.org>
Alan Stern [stern@rowland.harvard.edu] wrote:
> On Thu, 13 May 2004, Mike Anderson wrote:
>
> > The LLDD queuecommand should not be called after the return of
> > scsi_remove_host (unless we have a bug). The LLDD should not free its
> > resources until the release function is called on the struct device
> > passed in during the scsi_add_host call.
>
> Ah. We have a problem here, because usb-storage doesn't own that struct
> device. It is owned by the USB core, and usb-storage has no way to know
> when its release function has been called.
>
> Even worse, the release function may never be called at all. The device
> itself may still exist and be attached to the system even though the
> usb-storage driver has been unbound from it.
>
> There must be many other LLDDs with the same problem. Any driver that
> manages a PCI host controller, for example. The struct device it receives
> from the PCI layer isn't owned by the LLDD, yet that's what it must pass
> to scsi_add_host().
>
> How should we handle this?
>
I was incorrect in my previous statement. Well we may hold a reference
count on the struct device passed into the scsi_add_host until all
references on the host instance are gone and there maybe a positive ref
count on the hostt module until all devices are closed a instance of
LLDD should be able to do cleanup post return of scsi_remove_host. This
needs to be true or SCSI mid-layer would not honor the requirement for
the pci remove call.
I believe in the past you or someone else has mentioned that post the
return of scsi_remove_host a Scsi_Host instance still has a hostt and a
transportt which may be dangerous if all code paths are not correctly
handling a host in the SHOST_DEL state.
I guess we still have this current issue on what is happening in the
usb storage that it believes SCSI mid is still using the device. Is
something not cleaning up, or is something in SCSI mid not honoring the
SHOST_DEL state.
-andmike
--
Michael Anderson
andmike@us.ibm.com
next prev parent reply other threads:[~2004-05-14 17:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040514004132.GA10537@telpin.com.ar>
2004-05-14 3:11 ` [linux-usb-devel] BUG when removing USB flash drive Alan Stern
2004-05-14 5:36 ` Mike Anderson
2004-05-14 15:12 ` Alan Stern
2004-05-14 16:59 ` Mike Anderson [this message]
2004-05-14 19:33 ` Alan Stern
2004-05-14 20:04 ` James Bottomley
2004-05-14 21:13 ` Alan Stern
2004-05-14 21:55 ` Alberto Bertogli
2004-05-15 19:56 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040514165956.GA8122@us.ibm.com \
--to=andmike@us.ibm.com \
--cc=albertogli@telpin.com.ar \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox