From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>,
Hannes Reinecke <hare@suse.de>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target()
Date: Wed, 14 Oct 2015 08:45:56 -0700 [thread overview]
Message-ID: <1444837556.2220.43.camel@HansenPartnership.com> (raw)
In-Reply-To: <1444833547.19542.21.camel@suse.de>
On Wed, 2015-10-14 at 16:39 +0200, Johannes Thumshirn wrote:
> On Wed, 2015-10-14 at 07:30 -0700, James Bottomley wrote:
> > On Wed, 2015-10-14 at 15:50 +0200, Johannes Thumshirn wrote:
> > > Removing a SCSI target via scsi_remove_target() suspected to be
> > > racy. When a
> > > sibling get's removed from the list it can occassionly happen that
> > > one CPU is
> > > stuck endlessly looping around this code block
> > >
> > > list_for_each_entry(starget, &shost->__targets, siblings) {
> > > if (starget->state == STARGET_DEL)
> > > continue;
> >
> > How long is the __targets list? It seems a bit unlikely that this is
> > the exact cause, because for a short list all in STARGET_DEL that
> > loop
> > should exit very quickly. Where in the code does scsi_remove_target
> > +0x68/0x240 actually point to?
> >
> > Is it not a bit more likely that we're following a removed list
> > element?
> > Since that points back to itself, the list_for_each_entry() would
> > then
> > circulate forever. If that's the case the simple fix would be to use
> > the safe version of the list traversal macro.
>
> Yes it is traversing a removed element and yes the patches 2/3 and 3/3
> are introducing the safe version of list_for_each_entry(), but they
> also decouple the search for elements to be removed from the actual
> removal. This is what my initial proposal did as well. Christoph wanted
> me to decouple the whole process from the host_lock though and this is
> what this patches do as well now.
OK, so I really need you to separate the problems. Fixing the bug
you're reporting does not require a complete rework of the locking
infrastructure; it just requires replacing the traversal macro with the
safe version, can you verify that and it can go into fixes?
Then we can discuss the merits of doing a locking rework in this area
separately from the idea that it's some sort of bug fix.
James
next prev parent reply other threads:[~2015-10-14 15:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 13:50 Johannes Thumshirn
2015-10-14 13:50 ` [PATCH 1/3] SCSI: Introduce device_lock and target_lock in Scsi_Host Johannes Thumshirn
2015-10-14 14:14 ` Hannes Reinecke
2015-10-14 14:17 ` Hannes Reinecke
2015-10-14 14:35 ` kbuild test robot
2015-10-14 13:50 ` [PATCH 2/3] SCSI: Rework list handling in scsi_target_remove Johannes Thumshirn
2015-10-14 14:18 ` Hannes Reinecke
2015-10-14 13:50 ` [PATCH 3/3] SCSI: Rework list handling in __scsi_target_remove Johannes Thumshirn
2015-10-14 14:19 ` Hannes Reinecke
2015-10-14 14:30 ` [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() James Bottomley
2015-10-14 14:39 ` Johannes Thumshirn
2015-10-14 15:45 ` James Bottomley [this message]
2015-10-14 17:36 ` Johannes Thumshirn
2015-10-14 18:18 ` Christoph Hellwig
2015-10-16 11:24 ` Johannes Thumshirn
2015-10-14 16:12 ` Christoph Hellwig
2015-10-14 17:34 ` Johannes Thumshirn
2015-10-14 20:22 ` Ewan Milne
2015-10-15 7:07 ` Johannes Thumshirn
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=1444837556.2220.43.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome