All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Wuertele <dave-gnus@bfnet.com>
To: linux-scsi@vger.kernel.org
Subject: 2.4.18 usb-storage hotplug implementation question
Date: Wed, 20 Aug 2003 12:14:01 -0700	[thread overview]
Message-ID: <m3ada4xhty.fsf@bfnet.com> (raw)

I am trying to augment the 2.4.18 SCSI/USB code (usb-storage) code
to be able to hot-plug and detect usb-memory cards when
plugged in. I have things working, except when I pull
out a card when a lot of I/O is happening.

The general strategy that I am using is:

1. a task polls (READ_CAPACITY) for the 3 LUNs that i have
   (using a Phison chip).
2. When it succeeds, it mounts the device

-- user process does file i/o --

3. When the card is pulled, ideally, a READ_CAPACITY fails
   and the processes with open files are sent a kill signal (SIGHUP)
   and the device unmounted.

PROBLEM
When a process is reading from the card, if the card is pulled
the Phison chip sometimes locks up, so I:
	1. reset the hub port
	2. Fail the pending read

However there is times when the usb (submit) does not come back
fast enough, so the READ_10 times out (seems to take over 10 seconds).
The abort handler is called (by scsi), which unlinks the urb
and says ok (to abort). I then return a DID_ERROR to the
SCSI-CMD. However the bottom half handler of this command
says that since the timer went off, it returns doing nothing.
In the meanwhile the user-process is stuck inside the file/io
routines (waiting on the buffer completion - in TASK_UNINTERRUPTIBLE
state). So I cannot unmount the device (or handle new mounts).

Questions:

1. Is there a better strategy than the above for dectecting
   plug-unplug?

2. How do i handle the failure?

3. What am i supposed to do in abort handler, so that the SCSI
   subsystem can continue working?

Thanks,
Dave


             reply	other threads:[~2003-08-20 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-20 19:14 David Wuertele [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-08-20 19:13 2.4.18 usb-storage hotplug implementation question David Wuertele

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=m3ada4xhty.fsf@bfnet.com \
    --to=dave-gnus@bfnet.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.