Message ID | 1626167917-11972-2-git-send-email-guohanjun@huawei.com |
---|---|
State | New |
Headers | show |
Series | [Backport,for,5.10.y,1/7] 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 06d44ae..f0fa0c8 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1224,6 +1224,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);