bio_check_ro() only warns about a write to a read-only disk and lets it through. dm-qcow2 then allocates clusters in the top image although the table is read-only. The header is not updated for a read-only table, so enabled persistent bitmaps stay marked consistent while the image data changes under them.
Kill write requests in .clone_and_map when the table is read-only. https://virtuozzo.atlassian.net/browse/VSTOR-138887 Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Alexander Ivanov <[email protected]> --- drivers/md/dm-qcow2-map.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index bc317c8db3a6..1c269a78ad35 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -4506,6 +4506,10 @@ int qcow2_clone_and_map(struct dm_target *ti, struct request *rq, struct qcow2_rq *qrq; struct qio *qio; + if (op_is_write(req_op(rq)) && + !(dm_table_get_mode(ti->table) & BLK_OPEN_WRITE)) + return DM_MAPIO_KILL; + qrq = mempool_alloc(tgt->qrq_pool, GFP_ATOMIC); if (!qrq) return DM_MAPIO_KILL; -- 2.53.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
