public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: "tj@kernel.org" <tj@kernel.org>
To: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
	"jthumshirn@suse.de" <jthumshirn@suse.de>,
	"oleg@redhat.com" <oleg@redhat.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"ebiederm@xmission.com" <ebiederm@xmission.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"hare@suse.com" <hare@suse.com>,
	"jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>
Subject: Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock
Date: Mon, 30 Jul 2018 10:57:10 -0700	[thread overview]
Message-ID: <20180730175710.GK1206094@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <1dbc826ead5f8d9b84b50dd905cee834777b2628.camel@wdc.com>

Hello,

On Mon, Jul 30, 2018 at 05:50:02PM +0000, Bart Van Assche wrote:
> On Mon, 2018-07-30 at 10:31 -0700, tj@kernel.org wrote:
> > On Mon, Jul 30, 2018 at 05:28:11PM +0000, Bart Van Assche wrote:
> > > It's not clear to me how the sysfs_break_active_protection() should obtain
> > > the struct kernfs_node pointer to the attribute. Calling that function before
> > > device_remove_file_self() causes a double call to kernfs_break_active_protection(),
> > > which is wrong. Calling kernfs_find_and_get(kobj->sd, attr->name) after the
> > 
> > So, if you braek active protection explicitly, there's no need to call
> > remove_self().  It can just use regular remove.
> 
> But how to avoid that scsi_remove_device(to_scsi_device(dev)) gets called
> multiple times when using device_remove_self() and in case of concurrent
> writes into the SCSI device "delete" sysfs attribute?

So, scsi_remove_device() internally protects using scan_mutex and if
the whole thing is wrapped with break_active_prot, I don't think you
need to call remove_file_self at all, right?

Thanks.

-- 
tejun

  reply	other threads:[~2018-07-30 19:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 17:38 [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock Bart Van Assche
2018-07-26  1:47 ` Martin K. Petersen
2018-07-26 11:46 ` Johannes Thumshirn
2018-07-26 12:50 ` Jack Wang
2018-07-26 13:35 ` Tejun Heo
2018-07-26 14:09   ` Bart Van Assche
2018-07-26 14:14     ` tj
2018-07-26 21:57       ` Bart Van Assche
2018-07-30 14:13         ` tj
2018-07-30 17:28           ` Bart Van Assche
2018-07-30 17:31             ` tj
2018-07-30 17:50               ` Bart Van Assche
2018-07-30 17:57                 ` tj [this message]
2018-07-29  4:03   ` Bart Van Assche
2018-07-30 14:17     ` tj

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=20180730175710.GK1206094@devbig004.ftw2.facebook.com \
    --to=tj@kernel.org \
    --cc=Bart.VanAssche@wdc.com \
    --cc=ebiederm@xmission.com \
    --cc=hare@suse.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=stable@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