Skip to content
Snippets Groups Projects
  1. May 04, 2017
  2. Apr 26, 2017
  3. Apr 24, 2017
  4. Apr 21, 2017
  5. Apr 11, 2017
    • Fam Zheng's avatar
      block: Use bdrv_coroutine_enter to start I/O coroutines · e92f0e19
      Fam Zheng authored
      
      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: default avatarFam Zheng <famz@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      e92f0e19
    • Fam Zheng's avatar
      tests/block-job-txn: Don't start block job before adding to txn · d90fce94
      Fam Zheng authored
      
      Previously, before test_block_job_start returns, the job can already
      complete, as a result, the transactional state of other jobs added to
      the same txn later cannot be handled correctly.
      
      Move the block_job_start() calls to callers after
      block_job_txn_add_job() calls.
      
      Signed-off-by: default avatarFam Zheng <famz@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      d90fce94
  6. Apr 07, 2017
  7. Apr 04, 2017
  8. Apr 03, 2017
    • Peter Maydell's avatar
      tests/libqtest.c: Delete possible stale unix sockets · d9123d09
      Peter Maydell authored
      
      Occasionally if a test crashes or is interrupted by the user
      at the wrong moment it could leave behind a stale UNIX
      socket in /tmp/. This will then cause a subsequent test
      run to fail spuriously with
       tests/libqtest.c:70:init_socket: assertion failed (ret != -1): (-1 != -1)
      if it happens to reuse the same PID.
      
      Defend against this by deleting any stray stale socket before
      trying to open the new ones for this test.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1490963801-27870-1-git-send-email-peter.maydell@linaro.org
      d9123d09
    • Eric Blake's avatar
      iotests: Improve image-clear tests on non-aligned image · f82c5b17
      Eric Blake authored
      
      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: default avatarEric Blake <eblake@redhat.com>
      Message-id: 20170331185356.2479-4-eblake@redhat.com
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      f82c5b17
    • Daniel P. Berrangé's avatar
      iotests: fix 097 when run with qcow · 07ff948b
      Daniel P. Berrangé authored
      
      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: default avatarMax Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <20170221115512.21918-8-berrange@redhat.com>
      [eblake: test collisions: s/173/176/g]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 20170331185356.2479-2-eblake@redhat.com
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      07ff948b
    • Markus Armbruster's avatar
      nbd: Tidy up blockdev-add interface · 9445673e
      Markus Armbruster authored
      
      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: default avatarMarkus 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: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20170330221243.17333-1-mreitz@redhat.com
      
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      9445673e
  9. Mar 30, 2017
  10. Mar 28, 2017
  11. Mar 27, 2017
  12. Mar 24, 2017
  13. Mar 22, 2017
  14. Mar 21, 2017
  15. Mar 16, 2017
Loading