Skip to contentSkip to conversation

fs: dlm: possible ABBA deadlock

BUG Jia-Ju Bai 2 participants 3 messages Aug 19, 2021 – Aug 20, 2021

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

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 :)

Best wishes,
Jia-Ju Bai

#1 lore raw
Quoted 17 lines · Jia-Ju Bai

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

Quoted 6 lines

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

author
#2 lore raw
Quoted 18 lines · David Teigland
Quoted 17 lines · Jia-Ju Bai

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

Quoted 7 lines
Quoted 6 lines

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