1. 05 9月, 2017 1 次提交
  2. 04 9月, 2017 3 次提交
  3. 23 8月, 2017 1 次提交
  4. 08 8月, 2017 3 次提交
  5. 02 8月, 2017 2 次提交
    • M
      block: fix leaks in bdrv_open_driver() · 180ca19a
      Manos Pitsidianakis 提交于
      bdrv_open_driver() is called in two places, bdrv_new_open_driver() and
      bdrv_open_common(). In the latter, failure cleanup in is in its caller,
      bdrv_open_inherit(), which unrefs the bs->file of the failed driver open
      if it exists.
      
      Let's move the bs->file cleanup to bdrv_open_driver() to take care of
      all callers and do not set bs->drv to NULL unless the driver's open
      function failed. When bs is destroyed by removing its last reference, it
      calls bdrv_close() which checks bs->drv to perform the needed cleanups
      and also call the driver's close function. Since it cleans up options
      and opaque we must take care not leave dangling pointers.
      
      The error paths in bdrv_open_driver() are now two:
      If open fails, drv->bdrv_close() should not be called. Unref the child
      if it exists, free what we allocated and set bs->drv to NULL. Return the
      error and let callers free their stuff.
      
      If open succeeds but we fail after, return the error and let callers
      unref and delete their bs, while cleaning up their allocations.
      Signed-off-by: NManos Pitsidianakis <el13635@mail.ntua.gr>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      180ca19a
    • M
      block: fix dangling bs->explicit_options in block.c · 998cbd6a
      Manos Pitsidianakis 提交于
      In some error paths it is possible to QDECREF a freed dangling
      explicit_options, resulting in a heap overflow crash.  For example
      bdrv_open_inherit()'s fail unrefs it, then calls bdrv_unref which calls
      bdrv_close which also unrefs it.
      Signed-off-by: NManos Pitsidianakis <el13635@mail.ntua.gr>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      998cbd6a
  6. 24 7月, 2017 1 次提交
    • K
      block: Skip implicit nodes in query-block/blockstats · d3c8c674
      Kevin Wolf 提交于
      Commits 0db832f4 and 6cdbceb1 introduced the automatic insertion of filter
      nodes above the top layer of mirror and commit block jobs. The
      assumption made there was that since libvirt doesn't do node-level
      management of the block layer yet, it shouldn't be affected by added
      nodes.
      
      This is true as far as commands issued by libvirt are concerned. It only
      uses BlockBackend names to address nodes, so any operations it performs
      still operate on the root of the tree as intended.
      
      However, the assumption breaks down when you consider query commands,
      which return data for the wrong node now. These commands also return
      information on some child nodes (bs->file and/or bs->backing), which
      libvirt does make use of, and which refer to the wrong nodes, too.
      
      One of the consequences is that oVirt gets wrong information about the
      image size and stops the VM in response as long as a mirror or commit
      job is running:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1470634
      
      This patch fixes the problem by hiding the implicit nodes created
      automatically by the mirror and commit block jobs in the output of
      query-block and BlockBackend-based query-blockstats as long as the user
      doesn't indicate that they are aware of those nodes by providing a node
      name for them in the QMP command to start the block job.
      
      The node-based commands query-named-block-nodes and query-blockstats
      with query-nodes=true still show all nodes, including implicit ones.
      This ensures that users that are capable of node-level management can
      still access the full information; users that only know BlockBackends
      won't use these commands.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Tested-by: NEric Blake <eblake@redhat.com>
      d3c8c674
  7. 18 7月, 2017 1 次提交
    • J
      qemu-img: Check for backing image if specified during create · 6e6e55f5
      John Snow 提交于
      Or, rather, force the open of a backing image if one was specified
      for creation. Using a similar -unsafe option as rebase, allow qemu-img
      to ignore the backing file validation if possible.
      
      It may not always be possible, as in the existing case when a filesize
      for the new image was not specified.
      
      This is accomplished by shifting around the conditionals in
      bdrv_img_create, such that a backing file is always opened unless we
      provide BDRV_O_NO_BACKING. qemu-img is adjusted to pass this new flag
      when -u is provided to create.
      
      Sorry for the heinous looking diffstat, but it's mostly whitespace.
      
      Inspired by: https://bugzilla.redhat.com/show_bug.cgi?id=1213786Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6e6e55f5
  8. 13 7月, 2017 1 次提交
  9. 11 7月, 2017 10 次提交
  10. 16 6月, 2017 4 次提交
  11. 29 5月, 2017 2 次提交
    • M
      block/file-*: *_parse_filename() and colons · 03c320d8
      Max Reitz 提交于
      The file drivers' *_parse_filename() implementations just strip the
      optional protocol prefix off the filename. However, for e.g.
      "file:foo:bar", this would lead to "foo:bar" being stored as the BDS's
      filename which looks like it should be managed using the "foo" protocol.
      This is especially troublesome if you then try to resolve a backing
      filename based on "foo:bar".
      
      This issue can only occur if the stripped part is a relative filename
      ("file:/foo:bar" will be shortened to "/foo:bar" and having a slash
      before the first colon means that "/foo" is not recognized as a protocol
      part). Therefore, we can easily fix it by prepending "./" to such
      filenames.
      
      Before this patch:
      $ ./qemu-img create -f qcow2 backing.qcow2 64M
      Formatting 'backing.qcow2', fmt=qcow2 size=67108864 encryption=off
          cluster_size=65536 lazy_refcounts=off refcount_bits=16
      $ ./qemu-img create -f qcow2 -b backing.qcow2 file:top:image.qcow2
      Formatting 'file:top:image.qcow2', fmt=qcow2 size=67108864
          backing_file=backing.qcow2 encryption=off cluster_size=65536
          lazy_refcounts=off refcount_bits=16
      $ ./qemu-io file:top:image.qcow2
      can't open device file:top:image.qcow2: Could not open backing file:
          Unknown protocol 'top'
      
      After this patch:
      $ ./qemu-io file:top:image.qcow2
      [no error]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170522195217.12991-3-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      03c320d8
    • M
      block: Fix backing paths for filenames with colons · 0d54a6fe
      Max Reitz 提交于
      path_combine() naturally tries to preserve a protocol prefix. However,
      it recognizes such a prefix by scanning for the first colon; which is
      different from what path_has_protocol() does: There only is a protocol
      prefix if there is a colon before the first slash.
      
      A protocol prefix that is not recognized by path_has_protocol() is none,
      and should thus not be taken as one.
      
      Case in point, before this patch:
      $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
      qemu-img: ./top:image.qcow2: Could not open './top:backing.qcow2':
          No such file or directory
      
      Afterwards:
      $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
      qemu-img: ./top:image.qcow2: Could not open './backing.qcow2':
          No such file or directory
      Reported-by: Nyangyang <yangyang@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170522195217.12991-2-mreitz@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      0d54a6fe
  12. 11 5月, 2017 7 次提交
  13. 09 5月, 2017 3 次提交
  14. 28 4月, 2017 1 次提交