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 have.

https://virtuozzo.atlassian.net/browse/PSBM-157790
Signed-off-by: Alexander Atanasov <alexander.atana...@virtuozzo.com>
---
 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;
-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to