mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: diasyzhangqing@gmail.com
To: axboe@kernel.dk, linux-block@vger.kernel.org
Cc: jack@suse.cz, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, libaokun@linux.alibaba.com,
	ojaswin@linux.ibm.com, ritesh.list@gmail.com,
	yi.zhang@huawei.com,
	syzbot+d4ecb9a1e5b3dcf8baec@syzkaller.appspotmail.com,
	diasyzhang@tencent.com
Subject: [PATCH v2] block: make bdev_freeze() mutex waits killable
Date: Wed, 11 Nov 2026 20:35:29 +0800	[thread overview]
Message-ID: <20261111123530.871952-1-diasyzhangqing@gmail.com> (raw)
In-Reply-To: <20261110132118.11265-1-diasyzhangqing@gmail.com>

From: Qing Zhang <diasyzhang@tencent.com>

Concurrent bdev_freeze() callers may wait a long time on
bd_fsfreeze_mutex while another caller freezes and syncs the filesystem.
Use mutex_lock_killable() to allow fatal signals to interrupt this wait.

An interrupted wait returns -EINTR before bd_fsfreeze_count is
incremented, so no freeze reference needs to be dropped. This does not
make the filesystem freeze operation itself killable.

Reported-by: syzbot+d4ecb9a1e5b3dcf8baec@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d4ecb9a1e5b3dcf8baec
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Qing Zhang <diasyzhang@tencent.com>
---
 Changes since v1:
- per Jan's suggestion, move the killable wait from a new ext4
  per-superblock mutex into bdev_freeze() itself.

block/bdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/bdev.c b/block/bdev.c
index f20f91b3176e..e57be2320423 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -301,7 +301,9 @@ int bdev_freeze(struct block_device *bdev)
 {
 	int error = 0;
 
-	mutex_lock(&bdev->bd_fsfreeze_mutex);
+	error = mutex_lock_killable(&bdev->bd_fsfreeze_mutex);
+	if (error)
+		return error;
 
 	/* A device being removed from its filesystem refuses freezes. */
 	if (!atomic_inc_unless_negative(&bdev->bd_fsfreeze_count)) {
-- 
2.43.7


      parent reply	other threads:[~2026-11-11 12:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 15:31 [syzbot] [block?] [ext4?] INFO: task hung in bdev_freeze syzbot
2026-11-10 13:21 ` [PATCH] ext4: make concurrent DEFAULT shutdown waits killable diasyzhangqing
2026-11-10 13:35   ` Jan Kara
2026-11-11  3:27     ` diasyzhangqing
2026-11-11  4:46       ` [syzbot] [block?] [ext4?] INFO: task hung in bdev_freeze syzbot
2026-11-10 21:34   ` syzbot
2026-11-11 12:35   ` diasyzhangqing [this message]

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=20261111123530.871952-1-diasyzhangqing@gmail.com \
    --to=diasyzhangqing@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=diasyzhang@tencent.com \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=syzbot+d4ecb9a1e5b3dcf8baec@syzkaller.appspotmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /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

all inboxes | Powered by JetHome®