On Thu, Jan 7, 2021 at 4:11 AM Ming Lei <ming.lei@xxxxxxxxxx> wrote: [snip] > OK, looks it is fine to disable writeback cache in __loop_clr_fd(). > > BTW, just wondering why don't you disable WC unconditionally in > __loop_clr_fd() or clear it in the following way because WC can be > changed via sysfs? > > if (test_bit(QUEUE_FLAG_WC, &q->queue_flags)) > blk_queue_write_cache(q, false, false); > Nice catch. Fixed that in v3. That was actually a bug, where a read-only loop device (losetup -r) that had write cache enabled via sysfs while attached, would not disable it, since it was checking only for the read-only bits, thus still suffering from the original issue. Thanks, > Thanks, > Ming > -- Mauricio Faria de Oliveira