Skip to contentSkip to conversation

vvfat: Fix qcow write target driver specification

PATCH In review Max Reitz 3 participants 3 messages Jul 11, 2016 Block layer

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 vvfat: Fix qcow write target driver specification

First, bdrv_open_child() expects all options for the child to be prefixed by the child's name (and a separating dot). Second, bdrv_open_child() does not take ownership of the QDict passed to it but only extracts all options for the child, so if a QDict is created for the sole purpose of passing it to bdrv_open_child(), it needs to be freed afterwards.

This patch makes vvfat adhere to both of these rules.

---
 block/vvfat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/vvfat.c +2 -1
index c3f24c6..ba2620f 100644
@@ -3018,9 +3018,10 @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
     }
 
     options = qdict_new();
-    qdict_put(options, "driver", qstring_from_str("qcow"));
+    qdict_put(options, "write-target.driver", qstring_from_str("qcow"));
     s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs,
                               &child_vvfat_qcow, false, errp);
+    QDECREF(options);
     if (!s->qcow) {
         ret = -EINVAL;
         goto err;
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Max Reitz

First, bdrv_open_child() expects all options for the child to be prefixed by the child's name (and a separating dot). Second, bdrv_open_child() does not take ownership of the QDict passed to it but only extracts all options for the child, so if a QDict is created for the sole purpose of passing it to bdrv_open_child(), it needs to be freed afterwards.

Quoted 6 lines

This patch makes vvfat adhere to both of these rules.

---
 block/vvfat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 18 lines
block/vvfat.c +2 -1
index c3f24c6..ba2620f 100644
@@ -3018,9 +3018,10 @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
     }
 
     options = qdict_new();
-    qdict_put(options, "driver", qstring_from_str("qcow"));
+    qdict_put(options, "write-target.driver", qstring_from_str("qcow"));
     s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs,
                               &child_vvfat_qcow, false, errp);
+    QDECREF(options);
     if (!s->qcow) {
         ret = -EINVAL;
         goto err;
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Reviewed-by on v1 1/1
#2 lore raw
In reply to Max Reitz

Am 11.07.2016 um 15:54 hat Max Reitz geschrieben:

Quoted 10 lines

First, bdrv_open_child() expects all options for the child to be prefixed by the child's name (and a separating dot). Second, bdrv_open_child() does not take ownership of the QDict passed to it but only extracts all options for the child, so if a QDict is created for the sole purpose of passing it to bdrv_open_child(), it needs to be freed afterwards.

This patch makes vvfat adhere to both of these rules.