lkml.org 
[lkml]   [2021]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG] fs: super: possible ABBA deadlocks in do_thaw_all_callback() and freeze_bdev()
On Mon, Dec 27, 2021 at 10:03:35AM +0800, Jia-Ju Bai wrote:
> My static analysis tool reports several possible ABBA deadlocks in Linux
> 5.10:
>
> do_thaw_all_callback()
>   down_write(&sb->s_umount); --> Line 1028 (Lock A)
>   emergency_thaw_bdev()
>     thaw_bdev()
>       mutex_lock(&bdev->bd_fsfreeze_mutex); --> Line 602 (Lock B)
>
> freeze_bdev()
>   mutex_lock(&bdev->bd_fsfreeze_mutex); --> Line 556 (Lock B)
>   freeze_super()
>     down_write(&sb->s_umount); --> Line 1716 (Lock A)
>     down_write(&sb->s_umount); --> Line 1738 (Lock A)
>   deactivate_super()
>     down_write(&s->s_umount); --> Line 365 (Lock A)
>
> When do_thaw_all_callback() and freeze_bdev() are concurrently executed, the
> deadlocks can occur.
>
> I am not quite sure whether these possible deadlocks are real and how to fix
> them if them are real.
> Any feedback would be appreciated, thanks :)

As a rule, ABBA deadlocks that can actually occur are already found by
lockdep. Tools that think they've found something are generally wrong.
I'm not inclined to look in detail to find out why this tool is wrong
because lockdep is so effective.

\
 
 \ /
  Last update: 2021-12-27 03:10    [W:2.840 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site