Message ID | 20201203213400.84340-1-mfo@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | loop: disable write cache in __loop_clr_fd() | expand |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a58084c2ed7c..0e23ab151667 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1223,6 +1223,9 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) goto out_unlock; } + if (!(lo->lo_flags & LO_FLAGS_READ_ONLY) && filp->f_op->fsync) + blk_queue_write_cache(lo->lo_queue, false, false); + /* freeze request queue during the transition */ blk_mq_freeze_queue(lo->lo_queue);