From: Luben Tuikov <tluben@rogers.com>
To: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Cc: James Bottomley <James.Bottomley@steeleye.com>,
Mike Anderson <andmike@us.ibm.com>,
mochel@osdl.org, SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] scsi_set_host_offline (resend)
Date: Wed, 09 Apr 2003 16:53:40 -0400 [thread overview]
Message-ID: <3E948854.10007@rogers.com> (raw)
In-Reply-To: <20030330102156.B19226@one-eyed-alien.net>
Matthew Dharm wrote:
> I happen to agree with Oliver on this...
>
> As I see it, what we need to do is support both user-initiated removal and
> hardware-initiated removal. Refcounting should get us pretty far along for
> this.
>
> As I see it, when either usb-storage or the userspace tells SCSI that a
> device is gone/going away, cleanup should begin. Since everything is
> refcounted, the virtual HBA stays around only long enough for cleanup to
> occur.
A way to unifyingly achieve all this is to have an entry function
which is called when a device is being removed, in each subsystem,
a la xxx_dev_removal(dev);
Case 1: LLDD notification of device removal.
I.e. came from the interconnect (USB, Internet, Fibre) fabric.
These events (should) take place:
--->LLDD/interconnect/transport detects device removal from the fabric,
--->xxx_dev_removal(dev) ***,
--->scsi_dev_removal(dev),
--->block_dev_removal(dev),
--->sysfs_dev_removal(dev) (??? not sure),
---> hotplug, userspace, etc.
It then comes back to the LLDD entry.
*** "xxx" could be one of usb, fc, etc, just as a unifying point.
It may not be necessary, and may just call scsi_dev_removal().
The advantage of this intrastructure is that each function
is directly entrant, and doesn't _have_to_ be called from its
lower level equivalent.
The other advantage is (Case 2):
Case 2: Userspace initiated the removal of the device.
---> Userspace calls into kernel to remove a device,
---> kernel finds the device and calls xxx_dev_removal(dev).
---> the rest of the chain is as Case 1.
This way we get infrastructure/code reusability.
> If the request comes from userspace, then scripts should have made sure to
> umount/close/sync everything first. If the device is just yanked, we
> simply don't have that opportunity.
>
> Regardless of where the request comes from, the kernel needs to be able to
> handle bad user apps -- if nothing else, some app could ignore the message
> from the unplug request (regardless of where it comes from). If the
> userspace script did everything well, there are no references and
> everything gets cleaned up.
> If some app didn't close a device, the SCSI
> layer can just DID_ERROR all commands in the mid-layer while the LLDD has
> already cleaned-up -- but this is a case that must be handled!
This is true.
> Forcing usb-storage to go outside of kernelspace and then back into
> kernelspace is silly and dangerous. The potential for DoS or other evil is
> just too high.
This is true, and what is needed is only for userspace to be _notified_.
Userspace can get the same effect by using some sort of active polling.
Why should it do so, when the kernel can notify it in a nice way,
and such polling implementation (passive, i.e. intr) is much better
handled in the kernel.
I.e. we need the best of both worlds.
--
Luben
next prev parent reply other threads:[~2003-04-09 20:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-25 10:07 [PATCH] scsi_set_host_offline (resend) Mike Anderson
2003-03-25 17:37 ` James Bottomley
2003-03-25 18:45 ` Mike Anderson
2003-03-25 19:02 ` James Bottomley
2003-03-25 21:04 ` Patrick Mochel
2003-03-25 23:29 ` Mike Anderson
2003-03-27 15:42 ` James Bottomley
2003-03-29 0:31 ` Patrick Mansfield
2003-03-29 1:32 ` Matthew Dharm
2003-03-29 6:30 ` Mike Anderson
2003-03-29 14:43 ` James Bottomley
2003-03-29 19:04 ` Mike Anderson
2003-03-29 19:24 ` Oliver Neukum
2003-03-29 20:53 ` Matthew Dharm
2003-03-29 21:54 ` James Bottomley
2003-03-29 22:15 ` Matthew Dharm
2003-03-30 16:23 ` James Bottomley
2003-03-30 17:26 ` Oliver Neukum
2003-04-09 20:30 ` Luben Tuikov
2003-04-09 22:32 ` Oliver Neukum
2003-04-09 22:59 ` Luben Tuikov
2003-04-10 7:51 ` Oliver Neukum
2003-04-17 22:29 ` Luben Tuikov
2003-03-30 18:21 ` Matthew Dharm
2003-04-09 20:53 ` Luben Tuikov [this message]
2003-03-29 22:50 ` Oliver Neukum
2003-04-01 2:48 ` Mike Anderson
2003-04-02 7:42 ` Matthew Dharm
2003-04-03 2:05 ` Mike Anderson
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=3E948854.10007@rogers.com \
--to=tluben@rogers.com \
--cc=James.Bottomley@steeleye.com \
--cc=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mdharm-scsi@one-eyed-alien.net \
--cc=mochel@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox