From: Mike Anderson <andmike@us.ibm.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: mochel@osdl.org, SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] scsi_set_host_offline (resend)
Date: Tue, 25 Mar 2003 10:45:30 -0800 [thread overview]
Message-ID: <20030325184530.GA1202@beaverton.ibm.com> (raw)
In-Reply-To: <1048613872.2070.12.camel@mulgrave>
James Bottomley [James.Bottomley@SteelEye.com] wrote:
> On Tue, 2003-03-25 at 04:07, Mike Anderson wrote:
>
> This isn't right:
>
> > + spin_lock_irqsave(shost->host_lock, flags);
> > + for (lh = shost->my_devices.next;
> > + (!error) && (lh != &shost->my_devices);) {
> > + sdev = list_entry(lh, struct scsi_device, siblings);
> > + scsi_device_get(sdev);
> > + spin_unlock_irqrestore(shost->host_lock, flags);
>
> You can't use the host_lock to protect the list and then drop it in the
> middle of list traversal. Doing this is bound to have repercussions for
> hotplug. I know we're a total mess for hotplug now, but I'd rather not
> add to it.
>
Probably already implied by your comment but...
I am using the lock to keep the list stable only during the traverse to
the next device which I will get a ref before dropping the lock. The
list could change during the call to the function (i.e an addition /
removal of nodes I do not have ref to).
Even if we went with a subsystem bus_for_each function I believe you are
asking for more state as previous discussed on the host offline subject
to not allow more additions. Correct?
> This problem can't be unique to SCSI, so I think what we need is
> something like a device generic function, like bus_for_each_device,
> except that it's device_for_each_child or something. where we get a
> properly ref counted and protected list traversal that will work for
> hotplugging.
>
The bus_for_each solution currently use a rw sema which I thought would
not be a good choice for these type of operations as there is a
possibility that we may want to call functions (offline) in interrupt
context.
Are you indicating that sema operations would be ok?
A possible side issue that Mochel can correct me on is that the calling
function would be restricted some as it cannot call device_register /
device_unregister as it would block.
If we want to head this direction we may need to alter the relationship
of children nodes off hosts.
-andmike
--
Michael Anderson
andmike@us.ibm.com
next prev parent reply other threads:[~2003-03-25 18:45 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 [this message]
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
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=20030325184530.GA1202@beaverton.ibm.com \
--to=andmike@us.ibm.com \
--cc=James.Bottomley@SteelEye.com \
--cc=linux-scsi@vger.kernel.org \
--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