public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
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: Thu, 13 May 2004 22:36:23 -0700	[thread overview]
Message-ID: <20040514053623.GD3819@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0405132305400.32262-100000@netrider.rowland.org>

Alan Stern [stern@rowland.harvard.edu] wrote:
> This BUG happened because the SCSI layer was still using the drive after 
> usb-storage had called scsi_remove_host().

In this case the scsi_remove_host is being called in a unexpected
disconnect case. Any IOs in flight will be canceled in the mid-layer
(i.e., they will not be chased down with calls to eh_abort_handler).

> 
> This is an aspect of SCSI midlayer <-> low-level driver interaction that
> I'm not very clear about.  How long after the host is removed can the
> midlayer continue to use it?  How does the driver know when the midlayer
> is finished using the host so the driver can exit (and unload from
> memory)?

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. This release function could be
called post the scsi_host_dev_release function being called as it does a
put on this struct device. This chain of release calls is undefined as a
hotplug goes out on the remove calls, but if user space never umounts /
closes the device things will not fully cleanup.

-andmike
--
Michael Anderson
andmike@us.ibm.com


  reply	other threads:[~2004-05-14  5:36 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 [this message]
2004-05-14 15:12     ` Alan Stern
2004-05-14 16:59       ` Mike Anderson
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=20040514053623.GD3819@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