Re: module: fix module_refcount() return when running in a module exit routine

2015-01-29 Thread Bart Van Assche
On 01/28/15 22:45, James Bottomley wrote: > On Wed, 2015-01-28 at 10:23 +0100, Bart Van Assche wrote: >> Is this the latest version of this patch that is available ? I have >> tried to test the above patch. However, I couldn't test the impact of >> this patch on the SRP initiator driver since my te

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-28 Thread James Bottomley
On Wed, 2015-01-28 at 10:23 +0100, Bart Van Assche wrote: > On 01/23/15 19:42, James Bottomley wrote: > > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c > > index 08c90a7..31ba254 100644 > > --- a/drivers/scsi/scsi.c > > +++ b/drivers/scsi/scsi.c > > @@ -965,6 +965,15 @@ int scsi_report_opc

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-28 Thread Bart Van Assche
On 01/23/15 19:42, James Bottomley wrote: > diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c > index 08c90a7..31ba254 100644 > --- a/drivers/scsi/scsi.c > +++ b/drivers/scsi/scsi.c > @@ -965,6 +965,15 @@ int scsi_report_opcode(struct scsi_device *sdev, > unsigned char *buffer, > } > EXPORT

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-26 Thread Christoph Hellwig
On Fri, Jan 23, 2015 at 10:42:47AM -0800, James Bottomley wrote: > To that point, Rusty's patch just keeps the status quo in the new > module_refcount() environment, so it's the quick bandaid. > > I think the use case you're worrying about is what happens if someone > tries to use a device after m

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-23 Thread Rusty Russell
James Bottomley writes: > On Fri, 2015-01-23 at 05:17 -0800, Christoph Hellwig wrote: >> On Fri, Jan 23, 2015 at 01:24:15PM +1030, Rusty Russell wrote: >> > The correct fix is to turn try_module_get() into __module_get(), and >> > always do the module_put(). >> >> Is this really safe? __module_g

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-23 Thread James Bottomley
On Fri, 2015-01-23 at 05:17 -0800, Christoph Hellwig wrote: > On Fri, Jan 23, 2015 at 01:24:15PM +1030, Rusty Russell wrote: > > The correct fix is to turn try_module_get() into __module_get(), and > > always do the module_put(). > > Is this really safe? __module_get sais it needs a non-zero refc

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-23 Thread Christoph Hellwig
On Fri, Jan 23, 2015 at 01:24:15PM +1030, Rusty Russell wrote: > The correct fix is to turn try_module_get() into __module_get(), and > always do the module_put(). Is this really safe? __module_get sais it needs a non-zero refcount to start with, but scsi_device_get is the only thing every increm

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-22 Thread Rusty Russell
James Bottomley writes: > On Thu, 2015-01-22 at 08:50 -0800, Christoph Hellwig wrote: >> We'll also still need to change scsi_device_put to deal with >> a negative refcount.. > > I don't believe so ... we never call module_refcount() now, and the > actual module ref count never goes negative. Tha

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-22 Thread James Bottomley
On Thu, 2015-01-22 at 08:50 -0800, Christoph Hellwig wrote: > On Tue, Jan 20, 2015 at 09:23:35AM -0800, James Bottomley wrote: > > On Tue, 2015-01-20 at 11:15 +1030, Rusty Russell wrote: > > > James Bottomley writes: > > > > On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: > > > >> Masami H

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-22 Thread Christoph Hellwig
On Tue, Jan 20, 2015 at 09:23:35AM -0800, James Bottomley wrote: > On Tue, 2015-01-20 at 11:15 +1030, Rusty Russell wrote: > > James Bottomley writes: > > > On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: > > >> Masami Hiramatsu writes: > > >> > (2015/01/19 1:55), James Bottomley wrote: >

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-21 Thread Rusty Russell
James Bottomley writes: > Actually, I don't think this is enough. Some Australian once came up > with a guide to APIs, and lectured on it at length, one of which was > that the name should be the obvious use and it is unexpected that a > refcount would go negative. I think we could raise it from

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-20 Thread James Bottomley
On Tue, 2015-01-20 at 11:15 +1030, Rusty Russell wrote: > James Bottomley writes: > > On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: > >> Masami Hiramatsu writes: > >> > (2015/01/19 1:55), James Bottomley wrote: > >> >> From: James Bottomley > >> >> > >> >> After e513cc1 module: Remove

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread Masami Hiramatsu
(2015/01/20 9:45), Rusty Russell wrote: > James Bottomley writes: >> On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: >>> Masami Hiramatsu writes: (2015/01/19 1:55), James Bottomley wrote: > From: James Bottomley > > After e513cc1 module: Remove stop_machine from module u

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread Rusty Russell
James Bottomley writes: > On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: >> Masami Hiramatsu writes: >> > (2015/01/19 1:55), James Bottomley wrote: >> >> From: James Bottomley >> >> >> >> After e513cc1 module: Remove stop_machine from module unloading, >> >> module_refcount() is return

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread James Bottomley
On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: > Masami Hiramatsu writes: > > (2015/01/19 1:55), James Bottomley wrote: > >> From: James Bottomley > >> > >> After e513cc1 module: Remove stop_machine from module unloading, > >> module_refcount() is returning (unsigned long)-1 when called

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread James Bottomley
On Mon, 2015-01-19 at 00:28 -0800, Christoph Hellwig wrote: > On Mon, Jan 19, 2015 at 04:21:15PM +1030, Rusty Russell wrote: > > The first one I think should be eliminated, and the second one is simply > > an assertion before calling module_put() (which should probably be > > eliminated). The othe

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread Christoph Hellwig
On Mon, Jan 19, 2015 at 04:21:15PM +1030, Rusty Russell wrote: > The first one I think should be eliminated, and the second one is simply > an assertion before calling module_put() (which should probably be > eliminated). The others are just printing information. FYI, I've got a pathcset to elimi

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread Rusty Russell
Masami Hiramatsu writes: > (2015/01/19 1:55), James Bottomley wrote: >> From: James Bottomley >> >> After e513cc1 module: Remove stop_machine from module unloading, >> module_refcount() is returning (unsigned long)-1 when called from within >> a routine that runs in module_exit. This is confusi

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread Masami Hiramatsu
(2015/01/19 1:55), James Bottomley wrote: > From: James Bottomley > > After e513cc1 module: Remove stop_machine from module unloading, > module_refcount() is returning (unsigned long)-1 when called from within > a routine that runs in module_exit. This is confusing the scsi device > put code whi

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread Rusty Russell
James Bottomley writes: > From: James Bottomley > > After e513cc1 module: Remove stop_machine from module unloading, > module_refcount() is returning (unsigned long)-1 when called from within > a routine that runs in module_exit. This is confusing the scsi device > put code which is coded to det

module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread James Bottomley
From: James Bottomley After e513cc1 module: Remove stop_machine from module unloading, module_refcount() is returning (unsigned long)-1 when called from within a routine that runs in module_exit. This is confusing the scsi device put code which is coded to detect a module_refcount() of zero for