From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hannes Reinecke <hare@suse.de>,
Johannes Thumshirn <jthumshirn@suse.de>,
Sagi Grimberg <sagi@grimberg.me>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] Avoid that SCSI device removal through sysfs triggers a deadlock
Date: Sun, 30 Oct 2016 14:25:58 -0600 [thread overview]
Message-ID: <1477859158.2777.10.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <BLUPR02MB168399B25661CFC9D1DA93F381AF0@BLUPR02MB1683.namprd02.prod.outlook.com>
On Sun, 2016-10-30 at 19:22 +0000, Bart Van Assche wrote:
> On 10/28/16 19:08, James Bottomley wrote:
> > This is a deadlock caused by an inversion issue in kernfs (suicide
> > vs
> > non-suicide removes); so fixing it in SCSI alone really isn't
> > appropriate. I count at least five other subsystems all using this
> > mechanism, so they'll all be similarly affected. It looks to be
> > fairly
> > simply fixable inside kernfs, so please fix it that way.
>
> Hello James,
>
> Can you clarify this further? To me this looks like the result of how
> the SCSI core works rather than an issue in the kernfs layer.
I'm at a bit of a loss, the problem looks clear from the original
trace, so I'm not really sure what's not clear to you.
The inversion is between the scan mutex and s_active which is the
rather fanciful name Tejun gave to the hand rolled mutex in
kernfs_node.
The reason for the inversion is that s_active is taken when you open a
sysfs file, including the delete one. There's a special suidice path
to allow that file to be deleted while something else holds the lock.
However, if the delete path also takes any lock, and there's a way to
get into delete not via writing to sysfs (which is pretty much
universally true) then you get an inversion because kernfs_node mutex
is also taken when the file is removed, which is why it's not specific
to scsi.
Since you press the issue, I've got to say I'm not a huge fan of trying
to escape from a lock inversion by making some path asynchronous
because it usually leads to even more problems on down the road. If
there's some problem with the generic fix, there is a way of fixing
this in SCSI without introducing asynchronicity.
James
next prev parent reply other threads:[~2016-10-30 20:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 18:44 [PATCH] Avoid that SCSI device removal through sysfs triggers a deadlock Bart Van Assche
2016-10-27 9:36 ` Sagi Grimberg
2016-10-27 15:39 ` Bart Van Assche
2016-10-27 9:46 ` Johannes Thumshirn
2016-10-27 15:38 ` Bart Van Assche
2016-10-29 0:12 ` Johannes Thumshirn
2016-10-29 2:08 ` James Bottomley
2016-10-30 19:22 ` Bart Van Assche
2016-10-30 20:25 ` James Bottomley [this message]
2016-11-03 22:27 ` Bart Van Assche
2016-11-04 13:47 ` James Bottomley
2016-11-04 18:17 ` Bart Van Assche
2016-11-07 20:51 ` James Bottomley
-- strict thread matches above, loose matches on Subject: below --
2016-11-08 0:32 Bart Van Assche
2016-11-08 7:01 ` Greg KH
2016-11-08 15:34 ` James Bottomley
2016-11-08 15:28 ` James Bottomley
2016-11-08 16:52 ` Bart Van Assche
2016-11-08 18:01 ` James Bottomley
2016-11-08 19:13 ` Eric W. Biederman
2016-11-08 23:33 ` Bart Van Assche
2016-11-09 1:22 ` Eric W. Biederman
2016-11-08 23:44 ` James Bottomley
2016-11-09 0:57 ` Eric W. Biederman
2016-11-09 1:43 ` James Bottomley
2016-11-09 2:10 ` Eric W. Biederman
2016-11-11 1:37 ` James Bottomley
2016-11-11 4:13 ` Eric W. Biederman
2018-06-26 22:25 Bart Van Assche
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=1477859158.2777.10.camel@linux.vnet.ibm.com \
--to=jejb@linux.vnet.ibm.com \
--cc=Bart.VanAssche@sandisk.com \
--cc=hare@suse.de \
--cc=jthumshirn@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sagi@grimberg.me \
/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;
as well as URLs for NNTP newsgroup(s).