linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
@ 2016-04-05 21:19 Bastien Philbert
  2016-04-06  7:48 ` Julian Calaby
  0 siblings, 1 reply; 14+ messages in thread
From: Bastien Philbert @ 2016-04-05 21:19 UTC (permalink / raw)
  To: jejb; +Cc: martin.petersen, linux-scsi, linux-kernel

This fixes backwards locking in the function __csio_unreg_rnode to
properly lock before the call to the function csio_unreg_rnode and
not unlock with spin_unlock_irq as this would not allow the proper
protection for concurrent access on the shared csio_hw structure
pointer hw. In addition switch the locking after the critical region
function call to properly unlock instead with spin_unlock_irq on

Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
---
 drivers/scsi/csiostor/csio_rnode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_rnode.c b/drivers/scsi/csiostor/csio_rnode.c
index e9c3b04..029a09e 100644
--- a/drivers/scsi/csiostor/csio_rnode.c
+++ b/drivers/scsi/csiostor/csio_rnode.c
@@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
 		ln->last_scan_ntgts--;
 	}
 
-	spin_unlock_irq(&hw->lock);
-	csio_unreg_rnode(rn);
 	spin_lock_irq(&hw->lock);
+	csio_unreg_rnode(rn);
+	spin_unlock_irq(&hw->lock);
 
 	/* Cleanup I/Os that were waiting for rnode to unregister */
 	if (cmpl)
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-05 21:19 [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode Bastien Philbert
@ 2016-04-06  7:48 ` Julian Calaby
  2016-04-06 13:21   ` Bastien Philbert
  0 siblings, 1 reply; 14+ messages in thread
From: Julian Calaby @ 2016-04-06  7:48 UTC (permalink / raw)
  To: Bastien Philbert; +Cc: jejb, Martin K. Petersen, linux-scsi, linux-kernel

Hi Bastien,

On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
<bastienphilbert@gmail.com> wrote:
> This fixes backwards locking in the function __csio_unreg_rnode to
> properly lock before the call to the function csio_unreg_rnode and
> not unlock with spin_unlock_irq as this would not allow the proper
> protection for concurrent access on the shared csio_hw structure
> pointer hw. In addition switch the locking after the critical region
> function call to properly unlock instead with spin_unlock_irq on
>
> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
> ---
>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/csiostor/csio_rnode.c b/drivers/scsi/csiostor/csio_rnode.c
> index e9c3b04..029a09e 100644
> --- a/drivers/scsi/csiostor/csio_rnode.c
> +++ b/drivers/scsi/csiostor/csio_rnode.c
> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
>                 ln->last_scan_ntgts--;
>         }
>
> -       spin_unlock_irq(&hw->lock);
> -       csio_unreg_rnode(rn);
>         spin_lock_irq(&hw->lock);
> +       csio_unreg_rnode(rn);
> +       spin_unlock_irq(&hw->lock);

Are you _certain_ this is correct? This construct usually appears when
a function has a particular lock held, then needs to unlock it to call
some other function. Are you _certain_ that this isn't the case?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06  7:48 ` Julian Calaby
@ 2016-04-06 13:21   ` Bastien Philbert
  2016-04-06 13:38     ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Bastien Philbert @ 2016-04-06 13:21 UTC (permalink / raw)
  To: Julian Calaby; +Cc: jejb, Martin K. Petersen, linux-scsi, linux-kernel



On 2016-04-06 03:48 AM, Julian Calaby wrote:
> Hi Bastien,
> 
> On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> <bastienphilbert@gmail.com> wrote:
>> This fixes backwards locking in the function __csio_unreg_rnode to
>> properly lock before the call to the function csio_unreg_rnode and
>> not unlock with spin_unlock_irq as this would not allow the proper
>> protection for concurrent access on the shared csio_hw structure
>> pointer hw. In addition switch the locking after the critical region
>> function call to properly unlock instead with spin_unlock_irq on
>>
>> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
>> ---
>>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/csiostor/csio_rnode.c b/drivers/scsi/csiostor/csio_rnode.c
>> index e9c3b04..029a09e 100644
>> --- a/drivers/scsi/csiostor/csio_rnode.c
>> +++ b/drivers/scsi/csiostor/csio_rnode.c
>> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
>>                 ln->last_scan_ntgts--;
>>         }
>>
>> -       spin_unlock_irq(&hw->lock);
>> -       csio_unreg_rnode(rn);
>>         spin_lock_irq(&hw->lock);
>> +       csio_unreg_rnode(rn);
>> +       spin_unlock_irq(&hw->lock);
> 
> Are you _certain_ this is correct? This construct usually appears when
> a function has a particular lock held, then needs to unlock it to call
> some other function. Are you _certain_ that this isn't the case?
> 
> Thanks,
> 
Yes I am pretty certain this is correct. I checked the paths that called this function
and it was weired that none of them gradded the spinlock before hand.
Cheers,
Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 13:21   ` Bastien Philbert
@ 2016-04-06 13:38     ` James Bottomley
  2016-04-06 14:11       ` Bastien Philbert
  0 siblings, 1 reply; 14+ messages in thread
From: James Bottomley @ 2016-04-06 13:38 UTC (permalink / raw)
  To: Bastien Philbert, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel

On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
> 
> On 2016-04-06 03:48 AM, Julian Calaby wrote:
> > Hi Bastien,
> > 
> > On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> > <bastienphilbert@gmail.com> wrote:
> > > This fixes backwards locking in the function __csio_unreg_rnode
> > > to
> > > properly lock before the call to the function csio_unreg_rnode
> > > and
> > > not unlock with spin_unlock_irq as this would not allow the
> > > proper
> > > protection for concurrent access on the shared csio_hw structure
> > > pointer hw. In addition switch the locking after the critical
> > > region
> > > function call to properly unlock instead with spin_unlock_irq on
> > > 
> > > Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
> > > ---
> > >  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/scsi/csiostor/csio_rnode.c
> > > b/drivers/scsi/csiostor/csio_rnode.c
> > > index e9c3b04..029a09e 100644
> > > --- a/drivers/scsi/csiostor/csio_rnode.c
> > > +++ b/drivers/scsi/csiostor/csio_rnode.c
> > > @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
> > >                 ln->last_scan_ntgts--;
> > >         }
> > > 
> > > -       spin_unlock_irq(&hw->lock);
> > > -       csio_unreg_rnode(rn);
> > >         spin_lock_irq(&hw->lock);
> > > +       csio_unreg_rnode(rn);
> > > +       spin_unlock_irq(&hw->lock);
> > 
> > Are you _certain_ this is correct? This construct usually appears
> > when
> > a function has a particular lock held, then needs to unlock it to
> > call
> > some other function. Are you _certain_ that this isn't the case?
> > 
> > Thanks,
> > 
> Yes I am pretty certain this is correct. I checked the paths that
> called this function
> and it was weired that none of them gradded the spinlock before hand.

That's not good enough.  If your theory is correct, lockdep should be
dropping an already unlocked assertion in this codepath ... do you see
this?

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 13:38     ` James Bottomley
@ 2016-04-06 14:11       ` Bastien Philbert
  2016-04-06 14:24         ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Bastien Philbert @ 2016-04-06 14:11 UTC (permalink / raw)
  To: James Bottomley, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel



On 2016-04-06 09:38 AM, James Bottomley wrote:
> On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
>>
>> On 2016-04-06 03:48 AM, Julian Calaby wrote:
>>> Hi Bastien,
>>>
>>> On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
>>> <bastienphilbert@gmail.com> wrote:
>>>> This fixes backwards locking in the function __csio_unreg_rnode
>>>> to
>>>> properly lock before the call to the function csio_unreg_rnode
>>>> and
>>>> not unlock with spin_unlock_irq as this would not allow the
>>>> proper
>>>> protection for concurrent access on the shared csio_hw structure
>>>> pointer hw. In addition switch the locking after the critical
>>>> region
>>>> function call to properly unlock instead with spin_unlock_irq on
>>>>
>>>> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
>>>> ---
>>>>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/scsi/csiostor/csio_rnode.c
>>>> b/drivers/scsi/csiostor/csio_rnode.c
>>>> index e9c3b04..029a09e 100644
>>>> --- a/drivers/scsi/csiostor/csio_rnode.c
>>>> +++ b/drivers/scsi/csiostor/csio_rnode.c
>>>> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
>>>>                 ln->last_scan_ntgts--;
>>>>         }
>>>>
>>>> -       spin_unlock_irq(&hw->lock);
>>>> -       csio_unreg_rnode(rn);
>>>>         spin_lock_irq(&hw->lock);
>>>> +       csio_unreg_rnode(rn);
>>>> +       spin_unlock_irq(&hw->lock);
>>>
>>> Are you _certain_ this is correct? This construct usually appears
>>> when
>>> a function has a particular lock held, then needs to unlock it to
>>> call
>>> some other function. Are you _certain_ that this isn't the case?
>>>
>>> Thanks,
>>>
>> Yes I am pretty certain this is correct. I checked the paths that
>> called this function
>> and it was weired that none of them gradded the spinlock before hand.
> 
> That's not good enough.  If your theory is correct, lockdep should be
> dropping an already unlocked assertion in this codepath ... do you see
> this?
> 
> James
> 
> 
Yes I do. For now just drop the patch but I am still concerned that we are double unlocking here.
Bastien
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 14:11       ` Bastien Philbert
@ 2016-04-06 14:24         ` James Bottomley
  2016-04-06 14:36           ` Bastien Philbert
  0 siblings, 1 reply; 14+ messages in thread
From: James Bottomley @ 2016-04-06 14:24 UTC (permalink / raw)
  To: Bastien Philbert, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel

On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
> 
> On 2016-04-06 09:38 AM, James Bottomley wrote:
> > On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
> > > 
> > > On 2016-04-06 03:48 AM, Julian Calaby wrote:
> > > > Hi Bastien,
> > > > 
> > > > On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> > > > <bastienphilbert@gmail.com> wrote:
> > > > > This fixes backwards locking in the function
> > > > > __csio_unreg_rnode
> > > > > to
> > > > > properly lock before the call to the function
> > > > > csio_unreg_rnode
> > > > > and
> > > > > not unlock with spin_unlock_irq as this would not allow the
> > > > > proper
> > > > > protection for concurrent access on the shared csio_hw
> > > > > structure
> > > > > pointer hw. In addition switch the locking after the critical
> > > > > region
> > > > > function call to properly unlock instead with spin_unlock_irq
> > > > > on
> > > > > 
> > > > > Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
> > > > > ---
> > > > >  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/scsi/csiostor/csio_rnode.c
> > > > > b/drivers/scsi/csiostor/csio_rnode.c
> > > > > index e9c3b04..029a09e 100644
> > > > > --- a/drivers/scsi/csiostor/csio_rnode.c
> > > > > +++ b/drivers/scsi/csiostor/csio_rnode.c
> > > > > @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
> > > > >                 ln->last_scan_ntgts--;
> > > > >         }
> > > > > 
> > > > > -       spin_unlock_irq(&hw->lock);
> > > > > -       csio_unreg_rnode(rn);
> > > > >         spin_lock_irq(&hw->lock);
> > > > > +       csio_unreg_rnode(rn);
> > > > > +       spin_unlock_irq(&hw->lock);
> > > > 
> > > > Are you _certain_ this is correct? This construct usually
> > > > appears
> > > > when
> > > > a function has a particular lock held, then needs to unlock it
> > > > to
> > > > call
> > > > some other function. Are you _certain_ that this isn't the
> > > > case?
> > > > 
> > > > Thanks,
> > > > 
> > > Yes I am pretty certain this is correct. I checked the paths that
> > > called this function
> > > and it was weired that none of them gradded the spinlock before
> > > hand.
> > 
> > That's not good enough.  If your theory is correct, lockdep should
> > be
> > dropping an already unlocked assertion in this codepath ... do you
> > see
> > this?
> > 
> > James
> > 
> > 
> Yes I do.

You mean you don't see the lockdep assert, since you're asking to drop
the patch?

>  For now just drop the patch but I am still concerned that we are
> double unlocking here.

Really, no.  The pattern in the code indicates the lock is expected to
be held.  This can be wrong (sometimes code moves or people forget),
but if it is wrong we'll get an assert about unlock of an already
unlocked lock.  If there's no assert, the lock is held on entry and the
code is correct.

You're proposing patches based on misunderstandings of the code which
aren't backed up by actual issues and wasting everyone's time to look
at them.  Please begin with the hard evidence of a problem first, so
post the lockdep assert in the changelog so we know there's a real
problem.

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 14:24         ` James Bottomley
@ 2016-04-06 14:36           ` Bastien Philbert
  2016-04-06 17:14             ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Bastien Philbert @ 2016-04-06 14:36 UTC (permalink / raw)
  To: James Bottomley, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel



On 2016-04-06 10:24 AM, James Bottomley wrote:
> On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
>>
>> On 2016-04-06 09:38 AM, James Bottomley wrote:
>>> On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
>>>>
>>>> On 2016-04-06 03:48 AM, Julian Calaby wrote:
>>>>> Hi Bastien,
>>>>>
>>>>> On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
>>>>> <bastienphilbert@gmail.com> wrote:
>>>>>> This fixes backwards locking in the function
>>>>>> __csio_unreg_rnode
>>>>>> to
>>>>>> properly lock before the call to the function
>>>>>> csio_unreg_rnode
>>>>>> and
>>>>>> not unlock with spin_unlock_irq as this would not allow the
>>>>>> proper
>>>>>> protection for concurrent access on the shared csio_hw
>>>>>> structure
>>>>>> pointer hw. In addition switch the locking after the critical
>>>>>> region
>>>>>> function call to properly unlock instead with spin_unlock_irq
>>>>>> on
>>>>>>
>>>>>> Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
>>>>>> ---
>>>>>>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/scsi/csiostor/csio_rnode.c
>>>>>> b/drivers/scsi/csiostor/csio_rnode.c
>>>>>> index e9c3b04..029a09e 100644
>>>>>> --- a/drivers/scsi/csiostor/csio_rnode.c
>>>>>> +++ b/drivers/scsi/csiostor/csio_rnode.c
>>>>>> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
>>>>>>                 ln->last_scan_ntgts--;
>>>>>>         }
>>>>>>
>>>>>> -       spin_unlock_irq(&hw->lock);
>>>>>> -       csio_unreg_rnode(rn);
>>>>>>         spin_lock_irq(&hw->lock);
>>>>>> +       csio_unreg_rnode(rn);
>>>>>> +       spin_unlock_irq(&hw->lock);
>>>>>
>>>>> Are you _certain_ this is correct? This construct usually
>>>>> appears
>>>>> when
>>>>> a function has a particular lock held, then needs to unlock it
>>>>> to
>>>>> call
>>>>> some other function. Are you _certain_ that this isn't the
>>>>> case?
>>>>>
>>>>> Thanks,
>>>>>
>>>> Yes I am pretty certain this is correct. I checked the paths that
>>>> called this function
>>>> and it was weired that none of them gradded the spinlock before
>>>> hand.
>>>
>>> That's not good enough.  If your theory is correct, lockdep should
>>> be
>>> dropping an already unlocked assertion in this codepath ... do you
>>> see
>>> this?
>>>
>>> James
>>>
>>>
>> Yes I do.
> 
> You mean you don't see the lockdep assert, since you're asking to drop
> the patch?
> 
>>  For now just drop the patch but I am still concerned that we are
>> double unlocking here.
> 
> Really, no.  The pattern in the code indicates the lock is expected to
> be held.  This can be wrong (sometimes code moves or people forget),
> but if it is wrong we'll get an assert about unlock of an already
> unlocked lock.  If there's no assert, the lock is held on entry and the
> code is correct.
> 
> You're proposing patches based on misunderstandings of the code which
> aren't backed up by actual issues and wasting everyone's time to look
> at them.  Please begin with the hard evidence of a problem first, so
> post the lockdep assert in the changelog so we know there's a real
> problem.
> 
> James
> 
Certainly James. I think I just got carried away with the last few patches :(.
Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 14:36           ` Bastien Philbert
@ 2016-04-06 17:14             ` James Bottomley
  2016-04-06 17:23               ` Bastien Philbert
  0 siblings, 1 reply; 14+ messages in thread
From: James Bottomley @ 2016-04-06 17:14 UTC (permalink / raw)
  To: Bastien Philbert, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel

On Wed, 2016-04-06 at 10:36 -0400, Bastien Philbert wrote:
> 
> On 2016-04-06 10:24 AM, James Bottomley wrote:
> > On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
> > > 
> > > On 2016-04-06 09:38 AM, James Bottomley wrote:
> > > > On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
> > > > > 
> > > > > On 2016-04-06 03:48 AM, Julian Calaby wrote:
> > > > > > Hi Bastien,
> > > > > > 
> > > > > > On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> > > > > > <bastienphilbert@gmail.com> wrote:
> > > > > > > This fixes backwards locking in the function
> > > > > > > __csio_unreg_rnode
> > > > > > > to
> > > > > > > properly lock before the call to the function
> > > > > > > csio_unreg_rnode
> > > > > > > and
> > > > > > > not unlock with spin_unlock_irq as this would not allow
> > > > > > > the
> > > > > > > proper
> > > > > > > protection for concurrent access on the shared csio_hw
> > > > > > > structure
> > > > > > > pointer hw. In addition switch the locking after the
> > > > > > > critical
> > > > > > > region
> > > > > > > function call to properly unlock instead with
> > > > > > > spin_unlock_irq
> > > > > > > on
> > > > > > > 
> > > > > > > Signed-off-by: Bastien Philbert <
> > > > > > > bastienphilbert@gmail.com>
> > > > > > > ---
> > > > > > >  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
> > > > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > index e9c3b04..029a09e 100644
> > > > > > > --- a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > +++ b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode
> > > > > > > *rn)
> > > > > > >                 ln->last_scan_ntgts--;
> > > > > > >         }
> > > > > > > 
> > > > > > > -       spin_unlock_irq(&hw->lock);
> > > > > > > -       csio_unreg_rnode(rn);
> > > > > > >         spin_lock_irq(&hw->lock);
> > > > > > > +       csio_unreg_rnode(rn);
> > > > > > > +       spin_unlock_irq(&hw->lock);
> > > > > > 
> > > > > > Are you _certain_ this is correct? This construct usually
> > > > > > appears
> > > > > > when
> > > > > > a function has a particular lock held, then needs to unlock
> > > > > > it
> > > > > > to
> > > > > > call
> > > > > > some other function. Are you _certain_ that this isn't the
> > > > > > case?
> > > > > > 
> > > > > > Thanks,
> > > > > > 
> > > > > Yes I am pretty certain this is correct. I checked the paths
> > > > > that
> > > > > called this function
> > > > > and it was weired that none of them gradded the spinlock
> > > > > before
> > > > > hand.
> > > > 
> > > > That's not good enough.  If your theory is correct, lockdep
> > > > should
> > > > be
> > > > dropping an already unlocked assertion in this codepath ... do
> > > > you
> > > > see
> > > > this?
> > > > 
> > > > James
> > > > 
> > > > 
> > > Yes I do.
> > 
> > You mean you don't see the lockdep assert, since you're asking to 
> > drop the patch?
> > 
> > >  For now just drop the patch but I am still concerned that we are
> > > double unlocking here.
> > 
> > Really, no.  The pattern in the code indicates the lock is expected 
> > to be held.  This can be wrong (sometimes code moves or people
> > forget), but if it is wrong we'll get an assert about unlock of an 
> > already unlocked lock.  If there's no assert, the lock is held on 
> > entry and the code is correct.
> > 
> > You're proposing patches based on misunderstandings of the code 
> > which aren't backed up by actual issues and wasting everyone's time 
> > to look at them.  Please begin with the hard evidence of a problem 
> > first, so post the lockdep assert in the changelog so we know 
> > there's a real problem.
> > 
> > James
> > 
> Certainly James. I think I just got carried away with the last few 
> patches :(.

Is this Nick Krause?  An email reply that Martin forwarded but the list
didn't pick up (because it had a html part) suggests this.  What you're
doing is what got you banned from LKML the last time: sending patches
without evidence there's a problem or understanding the code you're
patching.  Repeating the behaviour under a new identity isn't going to
help improve your standing.

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 17:14             ` James Bottomley
@ 2016-04-06 17:23               ` Bastien Philbert
  2016-04-06 17:28                 ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Bastien Philbert @ 2016-04-06 17:23 UTC (permalink / raw)
  To: James Bottomley, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel



On 2016-04-06 01:14 PM, James Bottomley wrote:
> On Wed, 2016-04-06 at 10:36 -0400, Bastien Philbert wrote:
>>
>> On 2016-04-06 10:24 AM, James Bottomley wrote:
>>> On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
>>>>
>>>> On 2016-04-06 09:38 AM, James Bottomley wrote:
>>>>> On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
>>>>>>
>>>>>> On 2016-04-06 03:48 AM, Julian Calaby wrote:
>>>>>>> Hi Bastien,
>>>>>>>
>>>>>>> On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
>>>>>>> <bastienphilbert@gmail.com> wrote:
>>>>>>>> This fixes backwards locking in the function
>>>>>>>> __csio_unreg_rnode
>>>>>>>> to
>>>>>>>> properly lock before the call to the function
>>>>>>>> csio_unreg_rnode
>>>>>>>> and
>>>>>>>> not unlock with spin_unlock_irq as this would not allow
>>>>>>>> the
>>>>>>>> proper
>>>>>>>> protection for concurrent access on the shared csio_hw
>>>>>>>> structure
>>>>>>>> pointer hw. In addition switch the locking after the
>>>>>>>> critical
>>>>>>>> region
>>>>>>>> function call to properly unlock instead with
>>>>>>>> spin_unlock_irq
>>>>>>>> on
>>>>>>>>
>>>>>>>> Signed-off-by: Bastien Philbert <
>>>>>>>> bastienphilbert@gmail.com>
>>>>>>>> ---
>>>>>>>>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>>>>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>> b/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>> index e9c3b04..029a09e 100644
>>>>>>>> --- a/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>> +++ b/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode
>>>>>>>> *rn)
>>>>>>>>                 ln->last_scan_ntgts--;
>>>>>>>>         }
>>>>>>>>
>>>>>>>> -       spin_unlock_irq(&hw->lock);
>>>>>>>> -       csio_unreg_rnode(rn);
>>>>>>>>         spin_lock_irq(&hw->lock);
>>>>>>>> +       csio_unreg_rnode(rn);
>>>>>>>> +       spin_unlock_irq(&hw->lock);
>>>>>>>
>>>>>>> Are you _certain_ this is correct? This construct usually
>>>>>>> appears
>>>>>>> when
>>>>>>> a function has a particular lock held, then needs to unlock
>>>>>>> it
>>>>>>> to
>>>>>>> call
>>>>>>> some other function. Are you _certain_ that this isn't the
>>>>>>> case?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>> Yes I am pretty certain this is correct. I checked the paths
>>>>>> that
>>>>>> called this function
>>>>>> and it was weired that none of them gradded the spinlock
>>>>>> before
>>>>>> hand.
>>>>>
>>>>> That's not good enough.  If your theory is correct, lockdep
>>>>> should
>>>>> be
>>>>> dropping an already unlocked assertion in this codepath ... do
>>>>> you
>>>>> see
>>>>> this?
>>>>>
>>>>> James
>>>>>
>>>>>
>>>> Yes I do.
>>>
>>> You mean you don't see the lockdep assert, since you're asking to 
>>> drop the patch?
>>>
>>>>  For now just drop the patch but I am still concerned that we are
>>>> double unlocking here.
>>>
>>> Really, no.  The pattern in the code indicates the lock is expected 
>>> to be held.  This can be wrong (sometimes code moves or people
>>> forget), but if it is wrong we'll get an assert about unlock of an 
>>> already unlocked lock.  If there's no assert, the lock is held on 
>>> entry and the code is correct.
>>>
>>> You're proposing patches based on misunderstandings of the code 
>>> which aren't backed up by actual issues and wasting everyone's time 
>>> to look at them.  Please begin with the hard evidence of a problem 
>>> first, so post the lockdep assert in the changelog so we know 
>>> there's a real problem.
>>>
>>> James
>>>
>> Certainly James. I think I just got carried away with the last few 
>> patches :(.
> 
> Is this Nick Krause?  An email reply that Martin forwarded but the list
> didn't pick up (because it had a html part) suggests this.  What you're
> doing is what got you banned from LKML the last time: sending patches
> without evidence there's a problem or understanding the code you're
> patching.  Repeating the behaviour under a new identity isn't going to
> help improve your standing.
> 
> James
> 
No I am not Nick Krause. I am just aware of how he got banned a few years ago.
That email was a mistake by typo and was hoping nobody picked it up as they 
would then believe I was Nick Krause.
Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 17:23               ` Bastien Philbert
@ 2016-04-06 17:28                 ` James Bottomley
  2016-04-06 17:35                   ` Bastien Philbert
  2016-04-06 18:41                   ` Greg KH
  0 siblings, 2 replies; 14+ messages in thread
From: James Bottomley @ 2016-04-06 17:28 UTC (permalink / raw)
  To: Bastien Philbert, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel

On Wed, 2016-04-06 at 13:23 -0400, Bastien Philbert wrote:
> 
> On 2016-04-06 01:14 PM, James Bottomley wrote:
> > On Wed, 2016-04-06 at 10:36 -0400, Bastien Philbert wrote:
> > > 
> > > On 2016-04-06 10:24 AM, James Bottomley wrote:
> > > > On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
> > > > > 
> > > > > On 2016-04-06 09:38 AM, James Bottomley wrote:
> > > > > > On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
> > > > > > > 
> > > > > > > On 2016-04-06 03:48 AM, Julian Calaby wrote:
> > > > > > > > Hi Bastien,
> > > > > > > > 
> > > > > > > > On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> > > > > > > > <bastienphilbert@gmail.com> wrote:
> > > > > > > > > This fixes backwards locking in the function
> > > > > > > > > __csio_unreg_rnode
> > > > > > > > > to
> > > > > > > > > properly lock before the call to the function
> > > > > > > > > csio_unreg_rnode
> > > > > > > > > and
> > > > > > > > > not unlock with spin_unlock_irq as this would not
> > > > > > > > > allow
> > > > > > > > > the
> > > > > > > > > proper
> > > > > > > > > protection for concurrent access on the shared
> > > > > > > > > csio_hw
> > > > > > > > > structure
> > > > > > > > > pointer hw. In addition switch the locking after the
> > > > > > > > > critical
> > > > > > > > > region
> > > > > > > > > function call to properly unlock instead with
> > > > > > > > > spin_unlock_irq
> > > > > > > > > on
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Bastien Philbert <
> > > > > > > > > bastienphilbert@gmail.com>
> > > > > > > > > ---
> > > > > > > > >  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
> > > > > > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > > 
> > > > > > > > > diff --git a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > index e9c3b04..029a09e 100644
> > > > > > > > > --- a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > +++ b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct
> > > > > > > > > csio_rnode
> > > > > > > > > *rn)
> > > > > > > > >                 ln->last_scan_ntgts--;
> > > > > > > > >         }
> > > > > > > > > 
> > > > > > > > > -       spin_unlock_irq(&hw->lock);
> > > > > > > > > -       csio_unreg_rnode(rn);
> > > > > > > > >         spin_lock_irq(&hw->lock);
> > > > > > > > > +       csio_unreg_rnode(rn);
> > > > > > > > > +       spin_unlock_irq(&hw->lock);
> > > > > > > > 
> > > > > > > > Are you _certain_ this is correct? This construct
> > > > > > > > usually
> > > > > > > > appears
> > > > > > > > when
> > > > > > > > a function has a particular lock held, then needs to
> > > > > > > > unlock
> > > > > > > > it
> > > > > > > > to
> > > > > > > > call
> > > > > > > > some other function. Are you _certain_ that this isn't
> > > > > > > > the
> > > > > > > > case?
> > > > > > > > 
> > > > > > > > Thanks,
> > > > > > > > 
> > > > > > > Yes I am pretty certain this is correct. I checked the
> > > > > > > paths
> > > > > > > that
> > > > > > > called this function
> > > > > > > and it was weired that none of them gradded the spinlock
> > > > > > > before
> > > > > > > hand.
> > > > > > 
> > > > > > That's not good enough.  If your theory is correct, lockdep
> > > > > > should
> > > > > > be
> > > > > > dropping an already unlocked assertion in this codepath ...
> > > > > > do
> > > > > > you
> > > > > > see
> > > > > > this?
> > > > > > 
> > > > > > James
> > > > > > 
> > > > > > 
> > > > > Yes I do.
> > > > 
> > > > You mean you don't see the lockdep assert, since you're asking
> > > > to 
> > > > drop the patch?
> > > > 
> > > > >  For now just drop the patch but I am still concerned that we
> > > > > are
> > > > > double unlocking here.
> > > > 
> > > > Really, no.  The pattern in the code indicates the lock is
> > > > expected 
> > > > to be held.  This can be wrong (sometimes code moves or people
> > > > forget), but if it is wrong we'll get an assert about unlock of
> > > > an 
> > > > already unlocked lock.  If there's no assert, the lock is held
> > > > on 
> > > > entry and the code is correct.
> > > > 
> > > > You're proposing patches based on misunderstandings of the code
> > > > which aren't backed up by actual issues and wasting everyone's
> > > > time 
> > > > to look at them.  Please begin with the hard evidence of a
> > > > problem 
> > > > first, so post the lockdep assert in the changelog so we know 
> > > > there's a real problem.
> > > > 
> > > > James
> > > > 
> > > Certainly James. I think I just got carried away with the last
> > > few 
> > > patches :(.
> > 
> > Is this Nick Krause?  An email reply that Martin forwarded but the 
> > list didn't pick up (because it had a html part) suggests this. 
> >  What you're doing is what got you banned from LKML the last time: 
> > sending patches without evidence there's a problem or understanding 
> > the code you're patching.  Repeating the behaviour under a new 
> > identity isn't going to help improve your standing.
> > 
> > James
> > 
> No I am not Nick Krause. I am just aware of how he got banned a few 
> years ago. That email was a mistake by typo and was hoping nobody 
> picked it up as they would then believe I was Nick Krause.

Hm, OK, but currently you are repeating his behaviour ... please don't
send any more patches until they're about real problems backed by
actual data.

Thanks,

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 17:28                 ` James Bottomley
@ 2016-04-06 17:35                   ` Bastien Philbert
  2016-04-06 18:41                   ` Greg KH
  1 sibling, 0 replies; 14+ messages in thread
From: Bastien Philbert @ 2016-04-06 17:35 UTC (permalink / raw)
  To: James Bottomley, Julian Calaby
  Cc: Martin K. Petersen, linux-scsi, linux-kernel



On 2016-04-06 01:28 PM, James Bottomley wrote:
> On Wed, 2016-04-06 at 13:23 -0400, Bastien Philbert wrote:
>>
>> On 2016-04-06 01:14 PM, James Bottomley wrote:
>>> On Wed, 2016-04-06 at 10:36 -0400, Bastien Philbert wrote:
>>>>
>>>> On 2016-04-06 10:24 AM, James Bottomley wrote:
>>>>> On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
>>>>>>
>>>>>> On 2016-04-06 09:38 AM, James Bottomley wrote:
>>>>>>> On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
>>>>>>>>
>>>>>>>> On 2016-04-06 03:48 AM, Julian Calaby wrote:
>>>>>>>>> Hi Bastien,
>>>>>>>>>
>>>>>>>>> On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
>>>>>>>>> <bastienphilbert@gmail.com> wrote:
>>>>>>>>>> This fixes backwards locking in the function
>>>>>>>>>> __csio_unreg_rnode
>>>>>>>>>> to
>>>>>>>>>> properly lock before the call to the function
>>>>>>>>>> csio_unreg_rnode
>>>>>>>>>> and
>>>>>>>>>> not unlock with spin_unlock_irq as this would not
>>>>>>>>>> allow
>>>>>>>>>> the
>>>>>>>>>> proper
>>>>>>>>>> protection for concurrent access on the shared
>>>>>>>>>> csio_hw
>>>>>>>>>> structure
>>>>>>>>>> pointer hw. In addition switch the locking after the
>>>>>>>>>> critical
>>>>>>>>>> region
>>>>>>>>>> function call to properly unlock instead with
>>>>>>>>>> spin_unlock_irq
>>>>>>>>>> on
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Bastien Philbert <
>>>>>>>>>> bastienphilbert@gmail.com>
>>>>>>>>>> ---
>>>>>>>>>>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>>>>>>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>>>> b/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>>>> index e9c3b04..029a09e 100644
>>>>>>>>>> --- a/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>>>> +++ b/drivers/scsi/csiostor/csio_rnode.c
>>>>>>>>>> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct
>>>>>>>>>> csio_rnode
>>>>>>>>>> *rn)
>>>>>>>>>>                 ln->last_scan_ntgts--;
>>>>>>>>>>         }
>>>>>>>>>>
>>>>>>>>>> -       spin_unlock_irq(&hw->lock);
>>>>>>>>>> -       csio_unreg_rnode(rn);
>>>>>>>>>>         spin_lock_irq(&hw->lock);
>>>>>>>>>> +       csio_unreg_rnode(rn);
>>>>>>>>>> +       spin_unlock_irq(&hw->lock);
>>>>>>>>>
>>>>>>>>> Are you _certain_ this is correct? This construct
>>>>>>>>> usually
>>>>>>>>> appears
>>>>>>>>> when
>>>>>>>>> a function has a particular lock held, then needs to
>>>>>>>>> unlock
>>>>>>>>> it
>>>>>>>>> to
>>>>>>>>> call
>>>>>>>>> some other function. Are you _certain_ that this isn't
>>>>>>>>> the
>>>>>>>>> case?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>> Yes I am pretty certain this is correct. I checked the
>>>>>>>> paths
>>>>>>>> that
>>>>>>>> called this function
>>>>>>>> and it was weired that none of them gradded the spinlock
>>>>>>>> before
>>>>>>>> hand.
>>>>>>>
>>>>>>> That's not good enough.  If your theory is correct, lockdep
>>>>>>> should
>>>>>>> be
>>>>>>> dropping an already unlocked assertion in this codepath ...
>>>>>>> do
>>>>>>> you
>>>>>>> see
>>>>>>> this?
>>>>>>>
>>>>>>> James
>>>>>>>
>>>>>>>
>>>>>> Yes I do.
>>>>>
>>>>> You mean you don't see the lockdep assert, since you're asking
>>>>> to 
>>>>> drop the patch?
>>>>>
>>>>>>  For now just drop the patch but I am still concerned that we
>>>>>> are
>>>>>> double unlocking here.
>>>>>
>>>>> Really, no.  The pattern in the code indicates the lock is
>>>>> expected 
>>>>> to be held.  This can be wrong (sometimes code moves or people
>>>>> forget), but if it is wrong we'll get an assert about unlock of
>>>>> an 
>>>>> already unlocked lock.  If there's no assert, the lock is held
>>>>> on 
>>>>> entry and the code is correct.
>>>>>
>>>>> You're proposing patches based on misunderstandings of the code
>>>>> which aren't backed up by actual issues and wasting everyone's
>>>>> time 
>>>>> to look at them.  Please begin with the hard evidence of a
>>>>> problem 
>>>>> first, so post the lockdep assert in the changelog so we know 
>>>>> there's a real problem.
>>>>>
>>>>> James
>>>>>
>>>> Certainly James. I think I just got carried away with the last
>>>> few 
>>>> patches :(.
>>>
>>> Is this Nick Krause?  An email reply that Martin forwarded but the 
>>> list didn't pick up (because it had a html part) suggests this. 
>>>  What you're doing is what got you banned from LKML the last time: 
>>> sending patches without evidence there's a problem or understanding 
>>> the code you're patching.  Repeating the behaviour under a new 
>>> identity isn't going to help improve your standing.
>>>
>>> James
>>>
>> No I am not Nick Krause. I am just aware of how he got banned a few 
>> years ago. That email was a mistake by typo and was hoping nobody 
>> picked it up as they would then believe I was Nick Krause.
> 
> Hm, OK, but currently you are repeating his behaviour ... please don't
> send any more patches until they're about real problems backed by
> actual data.
> 
> Thanks,
> 
> James
> 
> 
Ok sure I do have one patch that I tested and it worked for me but wasn't sure if I am just
trampling over the actual bug. If you would like me to send the patch and you can tell me 
if I am right please let me known.
Sorry about the other patches,
Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 17:28                 ` James Bottomley
  2016-04-06 17:35                   ` Bastien Philbert
@ 2016-04-06 18:41                   ` Greg KH
  2016-04-06 19:34                     ` Theodore Ts'o
  1 sibling, 1 reply; 14+ messages in thread
From: Greg KH @ 2016-04-06 18:41 UTC (permalink / raw)
  To: James Bottomley
  Cc: Bastien Philbert, Julian Calaby, Martin K. Petersen, linux-scsi,
	linux-kernel

On Wed, Apr 06, 2016 at 01:28:24PM -0400, James Bottomley wrote:
> On Wed, 2016-04-06 at 13:23 -0400, Bastien Philbert wrote:
> > 
> > On 2016-04-06 01:14 PM, James Bottomley wrote:
> > > On Wed, 2016-04-06 at 10:36 -0400, Bastien Philbert wrote:
> > > > 
> > > > On 2016-04-06 10:24 AM, James Bottomley wrote:
> > > > > On Wed, 2016-04-06 at 10:11 -0400, Bastien Philbert wrote:
> > > > > > 
> > > > > > On 2016-04-06 09:38 AM, James Bottomley wrote:
> > > > > > > On Wed, 2016-04-06 at 09:21 -0400, Bastien Philbert wrote:
> > > > > > > > 
> > > > > > > > On 2016-04-06 03:48 AM, Julian Calaby wrote:
> > > > > > > > > Hi Bastien,
> > > > > > > > > 
> > > > > > > > > On Wed, Apr 6, 2016 at 7:19 AM, Bastien Philbert
> > > > > > > > > <bastienphilbert@gmail.com> wrote:
> > > > > > > > > > This fixes backwards locking in the function
> > > > > > > > > > __csio_unreg_rnode
> > > > > > > > > > to
> > > > > > > > > > properly lock before the call to the function
> > > > > > > > > > csio_unreg_rnode
> > > > > > > > > > and
> > > > > > > > > > not unlock with spin_unlock_irq as this would not
> > > > > > > > > > allow
> > > > > > > > > > the
> > > > > > > > > > proper
> > > > > > > > > > protection for concurrent access on the shared
> > > > > > > > > > csio_hw
> > > > > > > > > > structure
> > > > > > > > > > pointer hw. In addition switch the locking after the
> > > > > > > > > > critical
> > > > > > > > > > region
> > > > > > > > > > function call to properly unlock instead with
> > > > > > > > > > spin_unlock_irq
> > > > > > > > > > on
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Bastien Philbert <
> > > > > > > > > > bastienphilbert@gmail.com>
> > > > > > > > > > ---
> > > > > > > > > >  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
> > > > > > > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > > > 
> > > > > > > > > > diff --git a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > > b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > > index e9c3b04..029a09e 100644
> > > > > > > > > > --- a/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > > +++ b/drivers/scsi/csiostor/csio_rnode.c
> > > > > > > > > > @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct
> > > > > > > > > > csio_rnode
> > > > > > > > > > *rn)
> > > > > > > > > >                 ln->last_scan_ntgts--;
> > > > > > > > > >         }
> > > > > > > > > > 
> > > > > > > > > > -       spin_unlock_irq(&hw->lock);
> > > > > > > > > > -       csio_unreg_rnode(rn);
> > > > > > > > > >         spin_lock_irq(&hw->lock);
> > > > > > > > > > +       csio_unreg_rnode(rn);
> > > > > > > > > > +       spin_unlock_irq(&hw->lock);
> > > > > > > > > 
> > > > > > > > > Are you _certain_ this is correct? This construct
> > > > > > > > > usually
> > > > > > > > > appears
> > > > > > > > > when
> > > > > > > > > a function has a particular lock held, then needs to
> > > > > > > > > unlock
> > > > > > > > > it
> > > > > > > > > to
> > > > > > > > > call
> > > > > > > > > some other function. Are you _certain_ that this isn't
> > > > > > > > > the
> > > > > > > > > case?
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > 
> > > > > > > > Yes I am pretty certain this is correct. I checked the
> > > > > > > > paths
> > > > > > > > that
> > > > > > > > called this function
> > > > > > > > and it was weired that none of them gradded the spinlock
> > > > > > > > before
> > > > > > > > hand.
> > > > > > > 
> > > > > > > That's not good enough.  If your theory is correct, lockdep
> > > > > > > should
> > > > > > > be
> > > > > > > dropping an already unlocked assertion in this codepath ...
> > > > > > > do
> > > > > > > you
> > > > > > > see
> > > > > > > this?
> > > > > > > 
> > > > > > > James
> > > > > > > 
> > > > > > > 
> > > > > > Yes I do.
> > > > > 
> > > > > You mean you don't see the lockdep assert, since you're asking
> > > > > to 
> > > > > drop the patch?
> > > > > 
> > > > > >  For now just drop the patch but I am still concerned that we
> > > > > > are
> > > > > > double unlocking here.
> > > > > 
> > > > > Really, no.  The pattern in the code indicates the lock is
> > > > > expected 
> > > > > to be held.  This can be wrong (sometimes code moves or people
> > > > > forget), but if it is wrong we'll get an assert about unlock of
> > > > > an 
> > > > > already unlocked lock.  If there's no assert, the lock is held
> > > > > on 
> > > > > entry and the code is correct.
> > > > > 
> > > > > You're proposing patches based on misunderstandings of the code
> > > > > which aren't backed up by actual issues and wasting everyone's
> > > > > time 
> > > > > to look at them.  Please begin with the hard evidence of a
> > > > > problem 
> > > > > first, so post the lockdep assert in the changelog so we know 
> > > > > there's a real problem.
> > > > > 
> > > > > James
> > > > > 
> > > > Certainly James. I think I just got carried away with the last
> > > > few 
> > > > patches :(.
> > > 
> > > Is this Nick Krause?  An email reply that Martin forwarded but the 
> > > list didn't pick up (because it had a html part) suggests this. 
> > >  What you're doing is what got you banned from LKML the last time: 
> > > sending patches without evidence there's a problem or understanding 
> > > the code you're patching.  Repeating the behaviour under a new 
> > > identity isn't going to help improve your standing.
> > > 
> > > James
> > > 
> > No I am not Nick Krause. I am just aware of how he got banned a few 
> > years ago. That email was a mistake by typo and was hoping nobody 
> > picked it up as they would then believe I was Nick Krause.
> 
> Hm, OK, but currently you are repeating his behaviour ... please don't
> send any more patches until they're about real problems backed by
> actual data.

He's Nick, look at the email headers for proof.

James, and everyone else, please drop his patches.  I'll go get him
banned from vger again.

Nick, please stop, you have violated the DCO now, a much worse thing
than before.

greg k-h

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode
  2016-04-06 18:41                   ` Greg KH
@ 2016-04-06 19:34                     ` Theodore Ts'o
  0 siblings, 0 replies; 14+ messages in thread
From: Theodore Ts'o @ 2016-04-06 19:34 UTC (permalink / raw)
  To: Greg KH
  Cc: James Bottomley, Bastien Philbert, Julian Calaby,
	Martin K. Petersen, linux-scsi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

On Wed, Apr 06, 2016 at 11:41:49AM -0700, Greg KH wrote:
> > > > Is this Nick Krause?  An email reply that Martin forwarded but the 
> > > > list didn't pick up (because it had a html part) suggests this. 
> > > >  What you're doing is what got you banned from LKML the last time: 
> > > > sending patches without evidence there's a problem or understanding 
> > > > the code you're patching.  Repeating the behaviour under a new 
> > > > identity isn't going to help improve your standing.
> > > > 
> > > No I am not Nick Krause. I am just aware of how he got banned a few 
> > > years ago. That email was a mistake by typo and was hoping nobody 
> > > picked it up as they would then believe I was Nick Krause.
> > 
> > Hm, OK, but currently you are repeating his behaviour ... please don't
> > send any more patches until they're about real problems backed by
> > actual data.
> 
> He's Nick, look at the email headers for proof.
> 
> James, and everyone else, please drop his patches.  I'll go get him
> banned from vger again.
> 
> Nick, please stop, you have violated the DCO now, a much worse thing
> than before.

Even if Bastien is going to try to claim that he happens to live in
the same house as Nick, the following two patches clearly shows that
even if Bastien is violating the DCO by using a fake sock puppet, he's
violated the DCO by failing to give Nick credit for writing the
identical patch.

						- Ted


[-- Attachment #2: evidence.gz --]
[-- Type: application/gzip, Size: 7182 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode
       [not found] <1441300143-1143-1-git-send-email-xerofoify@gmail.com>
@ 2015-09-04 22:44 ` Anish Bhatt
  0 siblings, 0 replies; 14+ messages in thread
From: Anish Bhatt @ 2015-09-04 22:44 UTC (permalink / raw)
  To: Nicholas Krause, JBottomley, Praveen Madhavan
  Cc: hare, michaelc, davem, Hariprasad S, linux-scsi, linux-kernel


> -----Original Message-----
> From: Nicholas Krause [mailto:xerofoify@gmail.com]
> Sent: Thursday, September 3, 2015 10:09 AM
> To: JBottomley@odin.com
> Cc: hare@suse.de; michaelc@cs.wisc.edu; davem@davemloft.net; Anish
> Bhatt; Hariprasad S; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] csiostor:Fix backwards locking in the function
> __csio_unreg_rnode
> 
> This fixes backwards locking in the function __csio_unreg_rnode to properly
> lock before the call to the function csio_unreg_rnode and not unlock with
> spin_unlock_irq as this would not allow the proper protection for concurrent
> access on the shared csio_hw structure pointer hw. In addition switch the
> locking after the critical region function call to properly unlock instead with
> spin_unlock_irq on the shared structure pointer.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/scsi/csiostor/csio_rnode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_rnode.c
> b/drivers/scsi/csiostor/csio_rnode.c
> index e9c3b04..029a09e 100644
> --- a/drivers/scsi/csiostor/csio_rnode.c
> +++ b/drivers/scsi/csiostor/csio_rnode.c
> @@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
>  		ln->last_scan_ntgts--;
>  	}
> 
> -	spin_unlock_irq(&hw->lock);
> -	csio_unreg_rnode(rn);
>  	spin_lock_irq(&hw->lock);
> +	csio_unreg_rnode(rn);
> +	spin_unlock_irq(&hw->lock);
> 
>  	/* Cleanup I/Os that were waiting for rnode to unregister */
>  	if (cmpl)
> --
> 2.1.4

NACK, function is called with lock held.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-04-06 19:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 21:19 [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode Bastien Philbert
2016-04-06  7:48 ` Julian Calaby
2016-04-06 13:21   ` Bastien Philbert
2016-04-06 13:38     ` James Bottomley
2016-04-06 14:11       ` Bastien Philbert
2016-04-06 14:24         ` James Bottomley
2016-04-06 14:36           ` Bastien Philbert
2016-04-06 17:14             ` James Bottomley
2016-04-06 17:23               ` Bastien Philbert
2016-04-06 17:28                 ` James Bottomley
2016-04-06 17:35                   ` Bastien Philbert
2016-04-06 18:41                   ` Greg KH
2016-04-06 19:34                     ` Theodore Ts'o
     [not found] <1441300143-1143-1-git-send-email-xerofoify@gmail.com>
2015-09-04 22:44 ` [PATCH] csiostor:Fix " Anish Bhatt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).