1. 11 5月, 2017 10 次提交
  2. 29 4月, 2017 2 次提交
  3. 28 4月, 2017 1 次提交
    • E
      qcow2: Allow discard of final unaligned cluster · 048c5fd1
      Eric Blake 提交于
      As mentioned in commit 0c1bd469, we ignored requests to
      discard the trailing cluster of an unaligned image.  While
      discard is an advisory operation from the guest standpoint,
      (and we are therefore free to ignore any request), our
      qcow2 implementation exploits the fact that a discarded
      cluster reads back as 0.  As long as we discard on cluster
      boundaries, we are fine; but that means we could observe
      non-zero data leaked at the tail of an unaligned image.
      
      Enhance iotest 66 to cover this case, and fix the implementation
      to honor a discard request on the final partial cluster.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170407013709.18440-1-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      048c5fd1
  4. 27 4月, 2017 9 次提交
  5. 25 4月, 2017 3 次提交
  6. 11 4月, 2017 1 次提交
    • F
      block: Use bdrv_coroutine_enter to start I/O coroutines · e92f0e19
      Fam Zheng 提交于
      BDRV_POLL_WHILE waits for the started I/O by releasing bs's ctx then polling
      the main context, which relies on the yielded coroutine continuing on bs->ctx
      before notifying qemu_aio_context with bdrv_wakeup().
      
      Thus, using qemu_coroutine_enter to start I/O is wrong because if the coroutine
      is entered from main loop, co->ctx will be qemu_aio_context, as a result of the
      "release, poll, acquire" loop of BDRV_POLL_WHILE, race conditions happen when
      both main thread and the iothread access the same BDS:
      
        main loop                                iothread
      -----------------------------------------------------------------------
        blockdev_snapshot
          aio_context_acquire(bs->ctx)
                                                 virtio_scsi_data_plane_handle_cmd
          bdrv_drained_begin(bs->ctx)
          bdrv_flush(bs)
            bdrv_co_flush(bs)                      aio_context_acquire(bs->ctx).enter
              ...
              qemu_coroutine_yield(co)
            BDRV_POLL_WHILE()
              aio_context_release(bs->ctx)
                                                   aio_context_acquire(bs->ctx).return
                                                     ...
                                                       aio_co_wake(co)
              aio_poll(qemu_aio_context)               ...
                co_schedule_bh_cb()                    ...
                  qemu_coroutine_enter(co)             ...
      
                    /* (A) bdrv_co_flush(bs)           /* (B) I/O on bs */
                            continues... */
                                                   aio_context_release(bs->ctx)
              aio_context_acquire(bs->ctx)
      
      Note that in above case, bdrv_drained_begin() doesn't do the "release,
      poll, acquire" in BDRV_POLL_WHILE, because bs->in_flight == 0.
      
      Fix this by using bdrv_coroutine_enter and enter coroutine in the right
      context.
      
      iotests 109 output is updated because the coroutine reenter flow during
      mirror job complete is different (now through co_queue_wakeup, instead
      of the unconditional qemu_coroutine_switch before), making the end job
      len different.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      e92f0e19
  7. 07 4月, 2017 1 次提交
  8. 03 4月, 2017 3 次提交
    • E
      iotests: Improve image-clear tests on non-aligned image · f82c5b17
      Eric Blake 提交于
      Tweak 097 and 176 to operate on an image that is not cluster-aligned,
      to give further coverage of clearing out an entire image, including
      the recent fix to eliminate the difference between fast path (97) and
      slow (176) for qcow2.  Also tested on qcow (97 only, since qcow lacks
      snapshots).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170331185356.2479-4-eblake@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f82c5b17
    • D
      iotests: fix 097 when run with qcow · 07ff948b
      Daniel P. Berrange 提交于
      The previous commit:
      
        commit a3e1505d
        Author: Eric Blake <eblake@redhat.com>
        Date:   Mon Dec 5 09:49:34 2016 -0600
      
          qcow2: Don't strand clusters near 2G intervals during commit
      
      extended the 097 test case so that it did two passes, once
      with an internal snapshot, once without.
      
      qcow (v1) does not support internal snapshots, so this change
      broke test 097 when run against qcow.
      
      This splits 097 in two, creating a new 176 that tests the
      internal snapshot codepath, effectively putting 097 back
      to its content before the above commit.
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <20170221115512.21918-8-berrange@redhat.com>
      [eblake: test collisions: s/173/176/g]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170331185356.2479-2-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      07ff948b
    • M
      nbd: Tidy up blockdev-add interface · 9445673e
      Markus Armbruster 提交于
      SocketAddress is a simple union, and simple unions are awkward: they
      have their variant members wrapped in a "data" object on the wire, and
      require additional indirections in C.  I intend to limit its use to
      existing external interfaces, and convert all internal interfaces to
      SocketAddressFlat.
      
      BlockdevOptionsNbd is an external interface using SocketAddress.  We
      already use SocketAddressFlat elsewhere in blockdev-add.  Replace it
      by SocketAddressFlat while we can (it's new in 2.9) for simplicity and
      consistency.  For example,
      
          { "execute": "blockdev-add",
            "arguments": { "node-name": "foo", "driver": "nbd",
                           "server": { "type": "inet",
      		                 "data": { "host": "localhost",
      				           "port": "12345" } } } }
      
      becomes
      
          { "execute": "blockdev-add",
            "arguments": { "node-name": "foo", "driver": "nbd",
                           "server": { "type": "inet",
      		                 "host": "localhost", "port": "12345" } } }
      
      Since the internal interfaces still take SocketAddress, this requires
      conversion function socket_address_crumple().  It'll go away when I
      update the interfaces.
      
      Unfortunately, SocketAddress is also visible in -drive since 2.8:
      
          -drive if=none,driver=nbd,server.type=inet,server.data.host=127.0.0.1,server.data.port=12345
      
      Nobody should be using it, as it's fairly new and has never been
      documented, so adding still more compatibility gunk to keep it working
      isn't worth the trouble.  You now have to use
      
          -drive if=none,driver=nbd,server.type=inet,server.host=127.0.0.1,server.port=12345
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-id: 1490895797-29094-9-git-send-email-armbru@redhat.com
      
      [mreitz: Change iotest 147 accordingly]
      
      Because of this interface change, iotest 147 has to be adapted.
      Unfortunately, we cannot just flatten all of the addresses because
      nbd-server-start still takes a plain SocketAddress. Therefore, we need
      both and this is most easily achieved by writing the SocketAddress into
      the code and flattening it where necessary.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170330221243.17333-1-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      9445673e
  9. 28 3月, 2017 1 次提交
  10. 13 3月, 2017 1 次提交
  11. 01 3月, 2017 6 次提交
  12. 24 2月, 2017 2 次提交
    • K
      block: Attach bs->file only during .bdrv_open() · 4e4bf5c4
      Kevin Wolf 提交于
      The way that attaching bs->file worked was a bit unusual in that it was
      the only child that would be attached to a node which is not opened yet.
      Because of this, the block layer couldn't know yet which permissions the
      driver would eventually need.
      
      This patch moves the point where bs->file is attached to the beginning
      of the individual .bdrv_open() implementations, so drivers already know
      what they are going to do with the child. This is also more consistent
      with how driver-specific children work.
      
      For a moment, bdrv_open() gets its own BdrvChild to perform image
      probing, but instead of directly assigning this BdrvChild to the BDS, it
      becomes a temporary one and the node name is passed as an option to the
      drivers, so that they can simply use bdrv_open_child() to create another
      reference for their own use.
      
      This duplicated child for (the not opened yet) bs is not the final
      state, a follow-up patch will change the image probing code to use a
      BlockBackend, which is completely independent of bs.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      4e4bf5c4
    • J
      iotests: Fix another race in 030 · 2c3b44da
      John Snow 提交于
      We can't rely on a non-paused job to be present and running for us.
      Assume that if the job is not present that it completed already.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2c3b44da