Skip to content

Commit 6793b62

Browse files
author
Ming Lei
committed
loop: move lo_set_size() out of queue freeze
JIRA: https://issues.redhat.com/browse/RHEL-88159 commit 4bb08cf Author: Ming Lei <ming.lei@redhat.com> Date: Wed Jun 11 16:49:38 2025 +0800 loop: move lo_set_size() out of queue freeze It isn't necessary to freeze queue for updating disk size given submit_bio() doesn't grab queue usage counter for checking eod. Also many driver won't freeze queue for calling set_capacity_and_notify(). Move lo_set_size() out of queue freeze for fixing many lockdep warning report. Link: https://lore.kernel.org/linux-block/67ea99e0.050a0220.3c3d88.0042.GAE@google.com/ Reported-by: syzbot+9dd7dbb1a4b915dee638@syzkaller.appspotmail.com Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250611084938.108829-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 09176fc commit 6793b62

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/block/loop.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,19 +1248,18 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
12481248
lo->lo_flags &= ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
12491249
lo->lo_flags |= (info->lo_flags & LOOP_SET_STATUS_SETTABLE_FLAGS);
12501250

1251-
if (size_changed) {
1252-
loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
1253-
lo->lo_backing_file);
1254-
loop_set_size(lo, new_size);
1255-
}
1256-
12571251
/* update the direct I/O flag if lo_offset changed */
12581252
loop_update_dio(lo);
12591253

12601254
out_unfreeze:
12611255
blk_mq_unfreeze_queue(lo->lo_queue, memflags);
12621256
if (partscan)
12631257
clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
1258+
if (!err && size_changed) {
1259+
loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
1260+
lo->lo_backing_file);
1261+
loop_set_size(lo, new_size);
1262+
}
12641263
out_unlock:
12651264
mutex_unlock(&lo->lo_mutex);
12661265
if (partscan)

0 commit comments

Comments
 (0)