Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-05-02 Thread Tejun Heo
On Mon, Apr 28, 2014 at 08:39:47AM +0800, Li Zhong wrote: > Yes, maybe try to get the module reference is not bad before writing to > driver attributes, as it doesn't make much sense to really call the > callbacks for the driver attribute if the driver is being unload. Please don't do that spuriou

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-27 Thread Li Zhong
On Fri, 2014-04-25 at 09:59 -0400, Alan Stern wrote: > On Fri, 25 Apr 2014, Li Zhong wrote: > > > > No, this isn't self removal. The driver-attribute (not device-attribute) > > > store operation simply grabs a lock that is also held while the driver > > > is being deregistered at module unload. Ta

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-27 Thread Li Zhong
On Fri, 2014-04-25 at 09:54 -0400, Alan Stern wrote: > On Fri, 25 Apr 2014, Li Zhong wrote: > > > > I don't get why try_module_get() matters here. We can't call into > > > ->store if the object at hand is already destroyed and the underlying > > > module can't go away if the target device is stil

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-27 Thread Li Zhong
On Fri, 2014-04-25 at 12:15 +0200, Johan Hovold wrote: > On Fri, Apr 25, 2014 at 10:16:57AM +0800, Li Zhong wrote: > > On Thu, 2014-04-24 at 16:52 +0200, Johan Hovold wrote: > > > > No, this isn't self removal. The driver-attribute (not device-attribute) > > > store operation simply grabs a lock t

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-25 Thread Johan Hovold
On Fri, Apr 25, 2014 at 09:54:33AM -0400, Alan Stern wrote: > On Fri, 25 Apr 2014, Li Zhong wrote: > > > > I don't get why try_module_get() matters here. We can't call into > > > ->store if the object at hand is already destroyed and the underlying > > > module can't go away if the target device

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-25 Thread Alan Stern
On Fri, 25 Apr 2014, Li Zhong wrote: > > No, this isn't self removal. The driver-attribute (not device-attribute) > > store operation simply grabs a lock that is also held while the driver > > is being deregistered at module unload. Taking a reference to the module > > in this case will prevent de

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-25 Thread Alan Stern
On Fri, 25 Apr 2014, Li Zhong wrote: > > I don't get why try_module_get() matters here. We can't call into > > ->store if the object at hand is already destroyed and the underlying > > module can't go away if the target device is still alive. > > try_module_get() doesn't actually protect the obje

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-25 Thread Johan Hovold
On Fri, Apr 25, 2014 at 10:16:57AM +0800, Li Zhong wrote: > On Thu, 2014-04-24 at 16:52 +0200, Johan Hovold wrote: > > No, this isn't self removal. The driver-attribute (not device-attribute) > > store operation simply grabs a lock that is also held while the driver > > is being deregistered at mo

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-24 Thread Li Zhong
On Thu, 2014-04-24 at 16:52 +0200, Johan Hovold wrote: > On Thu, Apr 24, 2014 at 10:35:17AM -0400, Tejun Heo wrote: > > On Thu, Apr 24, 2014 at 04:29:15PM +0800, Li Zhong wrote: > > > On Wed, 2014-04-23 at 10:19 -0400, Tejun Heo wrote: > > > > cc'ing Li Zhong who's working on a simliar issue in the

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-24 Thread Li Zhong
On Thu, 2014-04-24 at 10:35 -0400, Tejun Heo wrote: > On Thu, Apr 24, 2014 at 04:29:15PM +0800, Li Zhong wrote: > > On Wed, 2014-04-23 at 10:19 -0400, Tejun Heo wrote: > > > cc'ing Li Zhong who's working on a simliar issue in the following > > > thread and quoting whole body. > > > > > > http://

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-24 Thread Johan Hovold
On Thu, Apr 24, 2014 at 10:35:17AM -0400, Tejun Heo wrote: > On Thu, Apr 24, 2014 at 04:29:15PM +0800, Li Zhong wrote: > > On Wed, 2014-04-23 at 10:19 -0400, Tejun Heo wrote: > > > cc'ing Li Zhong who's working on a simliar issue in the following > > > thread and quoting whole body. > > > > > >

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-24 Thread Tejun Heo
On Thu, Apr 24, 2014 at 04:29:15PM +0800, Li Zhong wrote: > On Wed, 2014-04-23 at 10:19 -0400, Tejun Heo wrote: > > cc'ing Li Zhong who's working on a simliar issue in the following > > thread and quoting whole body. > > > > http://thread.gmane.org/gmane.linux.kernel/1680706 > > > > Li, this is

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-24 Thread Li Zhong
On Wed, 2014-04-23 at 10:19 -0400, Tejun Heo wrote: > cc'ing Li Zhong who's working on a simliar issue in the following > thread and quoting whole body. > > http://thread.gmane.org/gmane.linux.kernel/1680706 > > Li, this is another variation of the same problem. Maybe this can be > covered by

Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-23 Thread Tejun Heo
cc'ing Li Zhong who's working on a simliar issue in the following thread and quoting whole body. http://thread.gmane.org/gmane.linux.kernel/1680706 Li, this is another variation of the same problem. Maybe this can be covered by your work too? Thanks. On Wed, Apr 23, 2014 at 11:32:19AM +0200,

[PATCH] USB: serial: fix sysfs-attribute removal deadlock

2014-04-23 Thread Johan Hovold
Fix driver new_id sysfs-attribute removal deadlock by making sure to not hold any locks that the attribute operations grab when removing the attribute. Specifically, usb_serial_deregister holds the table mutex when deregistering the driver, which includes removing the new_id attribute. This can le