On Mon, 2018-07-30 at 10:31 -0700, tj+AEA-kernel.org wrote: +AD4- On Mon, Jul 30, 2018 at 05:28:11PM +-0000, Bart Van Assche wrote: +AD4- +AD4- It's not clear to me how the sysfs+AF8-break+AF8-active+AF8-protection() should obtain +AD4- +AD4- the struct kernfs+AF8-node pointer to the attribute. Calling that function before +AD4- +AD4- device+AF8-remove+AF8-file+AF8-self() causes a double call to kernfs+AF8-break+AF8-active+AF8-protection(), +AD4- +AD4- which is wrong. Calling kernfs+AF8-find+AF8-and+AF8-get(kobj-+AD4-sd, attr-+AD4-name) after the +AD4- +AD4- So, if you braek active protection explicitly, there's no need to call +AD4- remove+AF8-self(). It can just use regular remove. But how to avoid that scsi+AF8-remove+AF8-device(to+AF8-scsi+AF8-device(dev)) gets called multiple times when using device+AF8-remove+AF8-self() and in case of concurrent writes into the SCSI device +ACI-delete+ACI- sysfs attribute? Thanks, Bart.