All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] fs: dlm: possible ABBA deadlock
@ 2021-08-19  8:54 ` Jia-Ju Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Jia-Ju Bai @ 2021-08-19  8:54 UTC (permalink / raw)
  To: ccaulfie, teigland; +Cc: cluster-devel, linux-kernel

Hello,

My static analysis tool reports a possible ABBA deadlock in the dlm 
filesystem in Linux 5.10:

dlm_recover_waiters_pre()
   mutex_lock(&ls->ls_waiters_mutex); --> line 5130
   recover_convert_waiter()
     _receive_convert_reply()
       lock_rsb()
         mutex_lock(&r->res_mutex); --> line 69

dlm_recover_waiters_post()
   lock_rsb()
     mutex_lock(&r->res_mutex); --> line 69
   mutex_lock(&ls->ls_waiters_mutex); --> line 5307

When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are 
concurrently executed, the deadlock can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks :)

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai

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

* [Cluster-devel] [BUG] fs: dlm: possible ABBA deadlock
@ 2021-08-19  8:54 ` Jia-Ju Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Jia-Ju Bai @ 2021-08-19  8:54 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hello,

My static analysis tool reports a possible ABBA deadlock in the dlm 
filesystem in Linux 5.10:

dlm_recover_waiters_pre()
 ? mutex_lock(&ls->ls_waiters_mutex); --> line 5130
 ? recover_convert_waiter()
 ??? _receive_convert_reply()
 ????? lock_rsb()
 ??????? mutex_lock(&r->res_mutex); --> line 69

dlm_recover_waiters_post()
 ? lock_rsb()
 ??? mutex_lock(&r->res_mutex); --> line 69
 ? mutex_lock(&ls->ls_waiters_mutex); --> line 5307

When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are 
concurrently executed, the deadlock can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks :)

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai



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

* Re: [BUG] fs: dlm: possible ABBA deadlock
  2021-08-19  8:54 ` [Cluster-devel] " Jia-Ju Bai
@ 2021-08-19 15:55   ` David Teigland
  -1 siblings, 0 replies; 6+ messages in thread
From: David Teigland @ 2021-08-19 15:55 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: cluster-devel, linux-kernel

On Thu, Aug 19, 2021 at 04:54:57PM +0800, Jia-Ju Bai wrote:
> Hello,
> 
> My static analysis tool reports a possible ABBA deadlock in the dlm
> filesystem in Linux 5.10:
> 
> dlm_recover_waiters_pre()
>   mutex_lock(&ls->ls_waiters_mutex); --> line 5130
>   recover_convert_waiter()
>     _receive_convert_reply()
>       lock_rsb()
>         mutex_lock(&r->res_mutex); --> line 69
> 
> dlm_recover_waiters_post()
>   lock_rsb()
>     mutex_lock(&r->res_mutex); --> line 69
>   mutex_lock(&ls->ls_waiters_mutex); --> line 5307
> 
> When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are
> concurrently executed, the deadlock can occur.
> 
> I am not quite sure whether this possible deadlock is real and how to fix it
> if it is real.
> Any feedback would be appreciated, thanks :)

They won't be concurrent, "pre" runs before recovery, and "post" is after.
Dave


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

* [Cluster-devel] [BUG] fs: dlm: possible ABBA deadlock
@ 2021-08-19 15:55   ` David Teigland
  0 siblings, 0 replies; 6+ messages in thread
From: David Teigland @ 2021-08-19 15:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thu, Aug 19, 2021 at 04:54:57PM +0800, Jia-Ju Bai wrote:
> Hello,
> 
> My static analysis tool reports a possible ABBA deadlock in the dlm
> filesystem in Linux 5.10:
> 
> dlm_recover_waiters_pre()
> ? mutex_lock(&ls->ls_waiters_mutex); --> line 5130
> ? recover_convert_waiter()
> ??? _receive_convert_reply()
> ????? lock_rsb()
> ??????? mutex_lock(&r->res_mutex); --> line 69
> 
> dlm_recover_waiters_post()
> ? lock_rsb()
> ??? mutex_lock(&r->res_mutex); --> line 69
> ? mutex_lock(&ls->ls_waiters_mutex); --> line 5307
> 
> When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are
> concurrently executed, the deadlock can occur.
> 
> I am not quite sure whether this possible deadlock is real and how to fix it
> if it is real.
> Any feedback would be appreciated, thanks :)

They won't be concurrent, "pre" runs before recovery, and "post" is after.
Dave



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

* Re: [BUG] fs: dlm: possible ABBA deadlock
  2021-08-19 15:55   ` [Cluster-devel] " David Teigland
@ 2021-08-20  8:16     ` Jia-Ju Bai
  -1 siblings, 0 replies; 6+ messages in thread
From: Jia-Ju Bai @ 2021-08-20  8:16 UTC (permalink / raw)
  To: David Teigland; +Cc: cluster-devel, linux-kernel



On 2021/8/19 23:55, David Teigland wrote:
> On Thu, Aug 19, 2021 at 04:54:57PM +0800, Jia-Ju Bai wrote:
>> Hello,
>>
>> My static analysis tool reports a possible ABBA deadlock in the dlm
>> filesystem in Linux 5.10:
>>
>> dlm_recover_waiters_pre()
>>    mutex_lock(&ls->ls_waiters_mutex); --> line 5130
>>    recover_convert_waiter()
>>      _receive_convert_reply()
>>        lock_rsb()
>>          mutex_lock(&r->res_mutex); --> line 69
>>
>> dlm_recover_waiters_post()
>>    lock_rsb()
>>      mutex_lock(&r->res_mutex); --> line 69
>>    mutex_lock(&ls->ls_waiters_mutex); --> line 5307
>>
>> When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are
>> concurrently executed, the deadlock can occur.
>>
>> I am not quite sure whether this possible deadlock is real and how to fix it
>> if it is real.
>> Any feedback would be appreciated, thanks :)
> They won't be concurrent, "pre" runs before recovery, and "post" is after.

Okay, thanks for your reply :)


Best wishes,
Jia-Ju Bai

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

* [Cluster-devel] [BUG] fs: dlm: possible ABBA deadlock
@ 2021-08-20  8:16     ` Jia-Ju Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Jia-Ju Bai @ 2021-08-20  8:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com



On 2021/8/19 23:55, David Teigland wrote:
> On Thu, Aug 19, 2021 at 04:54:57PM +0800, Jia-Ju Bai wrote:
>> Hello,
>>
>> My static analysis tool reports a possible ABBA deadlock in the dlm
>> filesystem in Linux 5.10:
>>
>> dlm_recover_waiters_pre()
>>  ? mutex_lock(&ls->ls_waiters_mutex); --> line 5130
>>  ? recover_convert_waiter()
>>  ??? _receive_convert_reply()
>>  ????? lock_rsb()
>>  ??????? mutex_lock(&r->res_mutex); --> line 69
>>
>> dlm_recover_waiters_post()
>>  ? lock_rsb()
>>  ??? mutex_lock(&r->res_mutex); --> line 69
>>  ? mutex_lock(&ls->ls_waiters_mutex); --> line 5307
>>
>> When dlm_recover_waiters_pre() and dlm_recover_waiters_post() are
>> concurrently executed, the deadlock can occur.
>>
>> I am not quite sure whether this possible deadlock is real and how to fix it
>> if it is real.
>> Any feedback would be appreciated, thanks :)
> They won't be concurrent, "pre" runs before recovery, and "post" is after.

Okay, thanks for your reply :)


Best wishes,
Jia-Ju Bai



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

end of thread, other threads:[~2021-08-20  8:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  8:54 [BUG] fs: dlm: possible ABBA deadlock Jia-Ju Bai
2021-08-19  8:54 ` [Cluster-devel] " Jia-Ju Bai
2021-08-19 15:55 ` David Teigland
2021-08-19 15:55   ` [Cluster-devel] " David Teigland
2021-08-20  8:16   ` Jia-Ju Bai
2021-08-20  8:16     ` [Cluster-devel] " Jia-Ju Bai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.