Skip to content

Commit 4bb08cf

Browse files
Ming Leiaxboe
authored andcommitted
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/[email protected]/ Reported-by: [email protected] Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 6f65947 commit 4bb08cf

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)