Skip to content

Commit 0cd719a

Browse files
Christoph Hellwigaxboe
authored andcommitted
loop: don't freeze the queue in loop_update_dio
All callers of loop_update_dio except for loop_configure already have the queue frozen, and loop_configure works on an unbound device. Remove the superfluous recursive freezing in loop_update_dio and add asserts for the locking and freezing state instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250110073750.1582447-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3a69311 commit 0cd719a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/block/loop.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ static inline void loop_update_dio(struct loop_device *lo)
201201
bool dio = lo->use_dio || (lo->lo_backing_file->f_flags & O_DIRECT);
202202
bool use_dio = dio && lo_can_use_dio(lo);
203203

204+
lockdep_assert_held(&lo->lo_mutex);
205+
WARN_ON_ONCE(lo->lo_state == Lo_bound &&
206+
lo->lo_queue->mq_freeze_depth == 0);
207+
204208
if (lo->use_dio == use_dio)
205209
return;
206210

@@ -213,15 +217,11 @@ static inline void loop_update_dio(struct loop_device *lo)
213217
* LO_FLAGS_READ_ONLY, both are set from kernel, and losetup
214218
* will get updated by ioctl(LOOP_GET_STATUS)
215219
*/
216-
if (lo->lo_state == Lo_bound)
217-
blk_mq_freeze_queue(lo->lo_queue);
218220
lo->use_dio = use_dio;
219221
if (use_dio)
220222
lo->lo_flags |= LO_FLAGS_DIRECT_IO;
221223
else
222224
lo->lo_flags &= ~LO_FLAGS_DIRECT_IO;
223-
if (lo->lo_state == Lo_bound)
224-
blk_mq_unfreeze_queue(lo->lo_queue);
225225
}
226226

227227
/**

0 commit comments

Comments
 (0)