1. 03 2月, 2016 6 次提交
    • J
      block: set device_list.tqe_prev to NULL on BDS removal · f8aa905a
      Jeff Cody 提交于
      This fixes a regression introduced with commit 3f09bfbc.  Multiple
      bugs arise in conjunction with live snapshots and mirroring operations
      (which include active layer commit).
      
      After a live snapshot occurs, the active layer and the base layer both
      have a non-NULL tqe_prev field in the device_list, although the base
      node's tqe_prev field points to a NULL entry.  This non-NULL tqe_prev
      field occurs after the bdrv_append() in the external snapshot calls
      change_parent_backing_link().
      
      In change_parent_backing_link(), when the previous active layer is
      removed from device_list, the device_list.tqe_prev pointer is not
      set to NULL.
      
      The operating scheme in the block layer is to indicate that a BDS belongs
      in the bdrv_states device_list iff the device_list.tqe_prev pointer
      is non-NULL.
      
      This patch does two things:
      
      1.) Introduces a new block layer helper bdrv_device_remove() to remove a
          BDS from the device_list, and
      2.) uses that new API, which also fixes the regression once used in
          change_parent_backing_link().
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Message-id: 0cd51e11c0666c04ddb7c05293fe94afeb551e89.1454376655.git.jcody@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f8aa905a
    • M
      block: Rewrite bdrv_close_all() · ca9bd24c
      Max Reitz 提交于
      This patch rewrites bdrv_close_all(): Until now, all root BDSs have been
      force-closed. This is bad because it can lead to cached data not being
      flushed to disk.
      
      Instead, try to make all reference holders relinquish their reference
      voluntarily:
      
      1. All BlockBackend users are handled by making all BBs simply eject
         their BDS tree. Since a BDS can never be on top of a BB, this will
         not cause any of the issues as seen with the force-closing of BDSs.
         The references will be relinquished and any further access to the BB
         will fail gracefully.
      2. All BDSs which are owned by the monitor itself (because they do not
         have a BB) are relinquished next.
      3. Besides BBs and the monitor, block jobs and other BDSs are the only
         things left that can hold a reference to BDSs. After every remaining
         block job has been canceled, there should not be any BDSs left (and
         the loop added here will always terminate (as long as NDEBUG is not
         defined), because either all_bdrv_states will be empty or there will
         not be any block job left to cancel, failing the assertion).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ca9bd24c
    • M
      block: Add list of all BlockDriverStates · 2c1d04e0
      Max Reitz 提交于
      We need this list so that bdrv_close_all() can keep track of which BDSs
      are still open after having removed the BDSs from all of the BBs and
      having released all monitor BDS references.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2c1d04e0
    • M
      block: Make bdrv_close() static · 64dff520
      Max Reitz 提交于
      There are no users of bdrv_close() left, except for one of bdrv_open()'s
      failure paths, bdrv_close_all() and bdrv_delete(), and that is good.
      Make bdrv_close() static so nobody makes the mistake of directly using
      bdrv_close() again.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      64dff520
    • M
      block: Remove BDS close notifier · 033cb565
      Max Reitz 提交于
      It is unused now, so we can remove it.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      033cb565
    • M
      block: Release named dirty bitmaps in bdrv_close() · c5acdc9a
      Max Reitz 提交于
      bdrv_delete() is not very happy about deleting BlockDriverStates with
      dirty bitmaps still attached to them. In the past, we got around that
      very easily by relying on bdrv_close_all() bypassing bdrv_delete(), and
      bdrv_close() simply ignoring that condition. We should fix that by
      releasing all named dirty bitmaps in bdrv_close() (there should not be
      any unnamed bitmaps left) and moving the assertion from bdrv_delete()
      there.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c5acdc9a
  2. 20 1月, 2016 4 次提交
    • K
      block: Inactivate BDS when migration completes · 76b1c7fe
      Kevin Wolf 提交于
      So far, live migration with shared storage meant that the image is in a
      not-really-ready don't-touch-me state on the destination while the
      source is still actively using it, but after completing the migration,
      the image was fully opened on both sides. This is bad.
      
      This patch adds a block driver callback to inactivate images on the
      source before completing the migration. Inactivation means that it goes
      to a state as if it was just live migrated to the qemu instance on the
      source (i.e. BDRV_O_INACTIVE is set). You're then supposed to continue
      either on the source or on the destination, which takes ownership of the
      image.
      
      A typical migration looks like this now with respect to disk images:
      
      1. Destination qemu is started, the image is opened with
         BDRV_O_INACTIVE. The image is fully opened on the source.
      
      2. Migration is about to complete. The source flushes the image and
         inactivates it. Now both sides have the image opened with
         BDRV_O_INACTIVE and are expecting the other side to still modify it.
      
      3. One side (the destination on success) continues and calls
         bdrv_invalidate_all() in order to take ownership of the image again.
         This removes BDRV_O_INACTIVE on the resuming side; the flag remains
         set on the other side.
      
      This ensures that the same image isn't written to by both instances
      (unless both are resumed, but then you get what you deserve). This is
      important because .bdrv_close for non-BDRV_O_INACTIVE images could write
      to the image file, which is definitely forbidden while another host is
      using the image.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      76b1c7fe
    • K
      block: Rename BDRV_O_INCOMING to BDRV_O_INACTIVE · 04c01a5c
      Kevin Wolf 提交于
      Instead of covering only the state of images on the migration
      destination before the migration is completed, the flag will also cover
      the state of images on the migration source after completion. This
      common state implies that the image is technically still open, but no
      writes will happen and any cached contents will be reloaded from disk if
      and when the image leaves this state.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      04c01a5c
    • K
      block: Fix error path in bdrv_invalidate_cache() · 23c88b24
      Kevin Wolf 提交于
      We can only clear BDRV_O_INCOMING if the caches were actually
      invalidated.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      23c88b24
    • K
      block: Fix .bdrv_open flags · 82dc8b41
      Kevin Wolf 提交于
      bdrv_common_open() modified bs->open_flags after inferring the set of
      options to pass to the driver's .bdrv_open callback. This means that the
      cache options were correctly set in bs->open_flags (and therefore
      correctly displayed in 'info block'), but the image would actually be
      opened with the default cache mode instead.
      
      This patch removes the flags parameter to bdrv_common_open() (except for
      BDRV_O_NO_BACKING it's the same as bs->open_flags anyway, and having two
      names for the same thing is confusing), and moves the assignment of
      open_flags down to immediately before calling into the block drivers. In
      all other places, bs->open_flags is now used consistently.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NDenis V. Lunev <den@openvz.org>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      82dc8b41
  3. 13 1月, 2016 2 次提交
    • M
      error: Use error_prepend() where it makes obvious sense · e43bfd9c
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch
      
          @@
          expression FMT, E1, E2;
          expression list ARGS;
          @@
          -    error_setg(E1, FMT, ARGS, error_get_pretty(E2));
          +    error_propagate(E1, E2);/*###*/
          +    error_prepend(E1, FMT/*@@@*/, ARGS);
      
      followed by manual cleanup, first because I can't figure out how to
      make Coccinelle transform strings, and second to get rid of now
      superfluous error_propagate().
      
      We now use or propagate the original error whole instead of just its
      message obtained with error_get_pretty().  This avoids suppressing its
      hint (see commit 50b7b000), but I can't see how the errors touched in
      this commit could come with hints.  It also improves the message
      printed with &error_abort when we screw up (see commit 1e9b65bb).
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      e43bfd9c
    • M
      block: Clean up "Could not create temporary overlay" error message · cd5c2dac
      Markus Armbruster 提交于
      bdrv_create() sets an error and returns -errno on failure.  When the
      latter is interesting, the error is created with error_setg_errno().
      
      bdrv_append_temp_snapshot() uses the error's message to create a new
      one with error_setg_errno().  This adds a strerror() that is either
      uninteresting or duplicate.  Use error_setg() instead.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1450452927-8346-7-git-send-email-armbru@redhat.com>
      cd5c2dac
  4. 08 1月, 2016 1 次提交
  5. 18 12月, 2015 14 次提交
  6. 17 12月, 2015 1 次提交
  7. 12 11月, 2015 2 次提交
  8. 11 11月, 2015 4 次提交
  9. 24 10月, 2015 6 次提交