linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: viro@zeniv.linux.org.uk, Jens Axboe <axboe@kernel.dk>, hch@infradead.org
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] fs: super: possible ABBA deadlocks in do_thaw_all_callback() and freeze_bdev()
Date: Mon, 27 Dec 2021 10:03:35 +0800	[thread overview]
Message-ID: <e3de0d83-1170-05c8-672c-4428e781b988@gmail.com> (raw)

Hello,

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

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


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2021-12-27  2:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  2:03 Jia-Ju Bai [this message]
2021-12-27  2:08 ` [BUG] fs: super: possible ABBA deadlocks in do_thaw_all_callback() and freeze_bdev() Matthew Wilcox
2021-12-27  4:39   ` Theodore Ts'o
2021-12-27  9:32     ` Jia-Ju Bai
2021-12-27 13:43       ` Theodore Ts'o
2021-12-28  2:31         ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3de0d83-1170-05c8-672c-4428e781b988@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).