From: Brian King <brking@us.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mike Anderson <andmike@us.ibm.com>, Dag Nygren <dag@newtech.fi>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: list_for_each_entry_safe() regarded as unsafe
Date: Fri, 10 Jun 2005 08:39:58 -0500 [thread overview]
Message-ID: <42A9982E.5020802@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0506091907520.30626-100000@netrider.rowland.org>
Alan Stern wrote:
> On Thu, 9 Jun 2005, Mike Anderson wrote:
>
>
>>Well we need a updated scsi_host state model that would prevent scanning
>>while we are removing the host. I would believe that if the oopses in
>>__scsi_remove_target where prevent there maybe some other oopses showing
>>up as the host started going away.
>
>
> More than that is needed -- you have to guarantee that two threads won't
> try to add or remove a target or device to the same host at the same time.
>
>
>>>I don't know what the best way is fix this. Even if scsi_forget_host()
>>>acquired the host's scan_mutex, that wouldn't be enough to guarantee the
>>>__targets and __devices lists won't change, would it? And it might cause
>>>interference with other pathways.
>>>
>>
>>Yes if scsi_forget_host acquired the scan_mutex it would deadlock when
>>scsi_remove_device acquired it later on in the call stack.
>
>
> How about not acquiring the scan_mutex in scsi_remove_device, and
> insisting that the caller hold it instead? There aren't that many places
> where it gets called. In fact, one of those places (an error pathway in
> scsi_sysfs_add_sdev) looks like it already will cause a deadlock.
scsi_remove_device is an exported symbol, so requiring the caller to obtain
the scan_mutex prior to calling it would not work. A __scsi_remove_device
could be created, however, which would not grab the scan_mutex so that scsi
core could do the right thing.
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
next prev parent reply other threads:[~2005-06-10 13:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-09 16:27 list_for_each_entry_safe() regarded as unsafe Alan Stern
2005-06-09 21:59 ` Mike Anderson
2005-06-09 23:19 ` Alan Stern
2005-06-10 13:39 ` Brian King [this message]
2005-06-10 15:26 ` 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=42A9982E.5020802@us.ibm.com \
--to=brking@us.ibm.com \
--cc=andmike@us.ibm.com \
--cc=dag@newtech.fi \
--cc=linux-scsi@vger.kernel.org \
--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