Re: sysfs methods can race with ->remove

2015-01-26 Thread Alan Stern
On Mon, 26 Jan 2015, Christoph Hellwig wrote: > On Thu, Jan 15, 2015 at 02:40:31PM -0500, Tejun Heo wrote: > > > If a method is registered by the driver, then the driver will > > > unregister it when the ->remove routine runs. I don't know for > > > certain, but I would expect that the sysfs/kern

Re: sysfs methods can race with ->remove

2015-01-26 Thread Christoph Hellwig
On Thu, Jan 15, 2015 at 02:40:31PM -0500, Tejun Heo wrote: > > If a method is registered by the driver, then the driver will > > unregister it when the ->remove routine runs. I don't know for > > certain, but I would expect that the sysfs/kernfs core will make sure > > that any existing method cal

Re: sysfs methods can race with ->remove

2015-01-15 Thread Tejun Heo
Hello, Alan. On Thu, Jan 15, 2015 at 01:22:03PM -0500, Alan Stern wrote: > > It has a reference to keep it from beeing freed, but so far I can't find > > anything that prevents ->remove from beeing called while we are in or > > just before a method call. > > There are two types of methods to thin

sysfs methods can race with ->remove

2015-01-15 Thread Alan Stern
Tejun: The context is that we have been talking about drivers/scsi/scsi_scan.c:scsi_rescan_device(), which is called by the store_rescan_field() sysfs method in scsi_sysfs.c. The problem is this: What happens in scsi_rescan_device if the device is unbound from its driver before the module_put cal