Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread t...@kernel.org
Hello, On Mon, Jul 30, 2018 at 05:50:02PM +, Bart Van Assche wrote: > On Mon, 2018-07-30 at 10:31 -0700, t...@kernel.org wrote: > > On Mon, Jul 30, 2018 at 05:28:11PM +, Bart Van Assche wrote: > > > It's not clear to me how the sysfs_break_active_protection()

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread t...@kernel.org
Hello, Bart. On Mon, Jul 30, 2018 at 05:28:11PM +, 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_b

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread t...@kernel.org
On Sun, Jul 29, 2018 at 04:03:41AM +, Bart Van Assche wrote: > On Thu, 2018-07-26 at 06:35 -0700, Tejun Heo wrote: > > Making removal asynchronous this way sometimes causes issues because > > whether the user sees the device released or not is racy. > > Hello Tejun, > > How could this change

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread t...@kernel.org
Hello, Bart. On Thu, Jul 26, 2018 at 09:57:40PM +, Bart Van Assche wrote: ... > @@ -440,11 +445,21 @@ bool sysfs_remove_file_self(struct kobject *kobj, const > struct attribute *attr) > return false; > > ret = kernfs_remove_self(kn); > + if (ret && cb) { > +

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-26 Thread t...@kernel.org
Hello, On Thu, Jul 26, 2018 at 02:09:41PM +, Bart Van Assche wrote: > On Thu, 2018-07-26 at 06:35 -0700, Tejun Heo wrote: > > Making removal asynchronous this way sometimes causes issues because > > whether the user sees the device released or not is racy. > > kernfs/sysfs have mechanisms to d

Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hey, On Mon, Mar 19, 2018 at 04:57:45PM +, Bart Van Assche wrote: > For synchronization primitives that wait having a stronger synchronization > primitive nested inside a more relaxed one can lead to a deadlock. But since > the rcu read lock primitives do not wait it could be safe to use that

Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hello, On Mon, Mar 19, 2018 at 04:18:54PM +, Bart Van Assche wrote: > The algorithm explained above does not depend on sched-rcu. But because > percpu_ref_tryget_live() uses sched-rcu and because we need to add an RCU lock > around that call we are forced to use sched-rcu. I hope this makes it

Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hello, On Mon, Mar 19, 2018 at 03:16:07PM +, Bart Van Assche wrote: > As explained in the comment in scsi_device_quiesce(), the effect of > blk_set_preempt_only() must be visible for percpu_ref_tryget() calls that > occur after the queue unfreeze triggered by scsi_device_quiesce(). Hence the >

Re: BUG: KASAN: use-after-free in scsi_exit_rq

2017-04-28 Thread t...@kernel.org
(cc'ing Jan) Hello, Bart. On Fri, Apr 21, 2017 at 09:49:17PM +, Bart Van Assche wrote: > On Thu, 2017-04-20 at 15:18 -0600, Scott Bauer wrote: > > [ 642.638860] BUG: KASAN: use-after-free in scsi_exit_rq+0xf3/0x120 at > > addr 8802b7fedf00 > > [ 642.639362] Read of size 1 by task rcuos