[PATCH v2] block: make bdev_freeze() mutex waits killable

From: diasyzhangqing

Date: Wed Nov 11 2026 - 07:44:56 EST


From: Qing Zhang <diasyzhang@xxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=d4ecb9a1e5b3dcf8baec
Suggested-by: Jan Kara <jack@xxxxxxx>
Signed-off-by: Qing Zhang <diasyzhang@xxxxxxxxxxx>
---
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