Message ID | 20210127141427.435751-1-mfo@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RESEND,v4] loop: fix I/O error on fsync() in detached loop devices | expand |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e5ff328f0917..e94a11dbb5bd 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1212,6 +1212,9 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) goto out_unlock; } + if (test_bit(QUEUE_FLAG_WC, &lo->lo_queue->queue_flags)) + blk_queue_write_cache(lo->lo_queue, false, false); + /* freeze request queue during the transition */ blk_mq_freeze_queue(lo->lo_queue);