[Devel] [PATCH RHEL9 COMMIT] dm-qcow2: relax extended l2 compatibility check

Konstantin Khorenko khorenko at virtuozzo.com
Wed Aug 14 14:57:08 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-427.26.1.vz9.66.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.26.1.vz9.66.4
------>
commit 863960b21eb17937bafde0cd052799609469ec41
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Mon Aug 12 22:09:31 2024 +0300

    dm-qcow2: relax extended l2 compatibility check
    
    Currently it is not possibly to load deltas with different
    extended l2.
    
    Relax this check to support the trivial case where
    bottom delta does not have extended l2 but upper one has.
    
    https://virtuozzo.atlassian.net/browse/PSBM-157790
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
    
    Feature: dm-qcow2: block device over QCOW2 files driver
---
 drivers/md/dm-qcow2-target.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index 871958ee9024..276eab9acc4f 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -756,9 +756,21 @@ static int qcow2_parse_header(struct dm_target *ti, struct qcow2 *qcow2,
 	    (qcow2->ext_l2 && qcow2->clu_size < PAGE_SIZE * 32))
 		goto out;
 	ret = -EXDEV;
-	if (upper && (upper->clu_size != qcow2->clu_size ||
-		      upper->ext_l2 != qcow2->ext_l2))
-		goto out; /* This is not supported yet */
+	if (upper) {
+		if (upper->clu_size != qcow2->clu_size) {
+			QC_ERR(ti, "dm-qcow2: clu_size mismatch\n");
+			goto out;
+		}
+		if (upper->ext_l2 != qcow2->ext_l2) {
+			if (is_bottom && upper->ext_l2 && !qcow2->ext_l2) {
+				QC_INFO(ti, "dm-qcow2: using bottom delta without ext_l2\n");
+			} else {
+				QC_ERR(ti, "dm-qcow2: upper delta without ext_l2 is unsupported\n");
+				goto out; /* This is not supported yet */
+			}
+		}
+	}
+
 	ret = -ENOENT;
 	if (is_bottom && qcow2->hdr.backing_file_offset)
 		goto out;


More information about the Devel mailing list