Skip to content
Snippets Groups Projects
  1. Sep 20, 2023
    • Kevin Wolf's avatar
      block: Introduce bdrv_schedule_unref() · ac2ae233
      Kevin Wolf authored
      
      bdrv_unref() is called by a lot of places that need to hold the graph
      lock (it naturally happens in the context of operations that change the
      graph). However, bdrv_unref() takes the graph writer lock internally, so
      it can't actually be called while already holding a graph lock without
      causing a deadlock.
      
      bdrv_unref() also can't just become GRAPH_WRLOCK because it drains the
      node before closing it, and draining requires that the graph is
      unlocked.
      
      The solution is to defer deleting the node until we don't hold the lock
      any more and draining is possible again.
      
      Note that keeping images open for longer than necessary can create
      problems, too: You can't open an image again before it is really closed
      (if image locking didn't prevent it, it would cause corruption).
      Reopening an image immediately happens at least during bdrv_open() and
      bdrv_co_create().
      
      In order to solve this problem, make sure to run the deferred unref in
      bdrv_graph_wrunlock(), i.e. the first possible place where we can drain
      again. This is also why bdrv_schedule_unref() is marked GRAPH_WRLOCK.
      
      The output of iotest 051 is updated because the additional polling
      changes the order of HMP output, resulting in a new "(qemu)" prompt in
      the test output that was previously on a separate line and filtered out.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-ID: <20230911094620.45040-6-kwolf@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      ac2ae233
  2. Sep 08, 2023
  3. Sep 06, 2023
  4. Aug 30, 2023
  5. Jun 28, 2023
  6. Jun 07, 2023
  7. Jun 05, 2023
  8. Jun 02, 2023
    • Eric Blake's avatar
      cutils: Use parse_uint in qemu_strtosz for negative rejection · b87ac966
      Eric Blake authored
      
      Rather than open-coding two different ways to check for an unwanted
      negative sign, reuse the same code in both functions.  That way, if we
      decide down the road to accept "-0" instead of rejecting it, we have
      fewer places to change.  Also, it means we now get ERANGE instead of
      EINVAL for negative values in qemu_strtosz, which is reasonable for
      what it represents.  This in turn changes the expected output of a
      couple of iotests.
      
      The change is not quite complete: negative fractional scaled values
      can trip us up.  This will be fixed in a later patch addressing other
      issues with fractional scaled values.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarHanna Czenczek <hreitz@redhat.com>
      Message-Id: <20230522190441.64278-18-eblake@redhat.com>
      b87ac966
    • Eric Blake's avatar
      iotests: Fix test 104 under NBD · 43074635
      Eric Blake authored
      
      In the past, commit a231cb27 ("iotests: Fix 104 for NBD", v2.3.0)
      added an additional filter to _filter_img_info to rewrite NBD URIs
      into the expected output form.  This recently broke when we tweaked
      tests to run in a per-format directory, which did not match the regex,
      because _img_info itself is now already changing
      SOCK_DIR=/tmp/tmpphjfbphd/raw-nbd-104 into
      /tmp/tmpphjfbphd/IMGFMT-nbd-104 prior to _img_info_filter getting a
      chance to further filter things.
      
      While diagnosing the problem, I also noticed some filter lines
      rendered completely useless by a typo when we switched from TCP to
      Unix sockets for NBD (in shell, '\\+' is different from "\\+" (one
      gives two backslash to the regex, matching the literal 2-byte sequence
      <\+> after a single digit; the other gives one backslash to the regex,
      as the metacharacter \+ to match one or more of <[0-9]>); since the
      literal string <nbd://127.0.0.1:0\+> is not a valid URI, that regex
      hasn't been matching anything for years so it is fine to just drop it
      rather than fix the typo.
      
      Fixes: f3923a72 ("iotests: Switch nbd tests to use Unix rather than TCP", v4.2.0)
      Fixes: 5ba7db09 ("iotests: always use a unique sub-directory per test", v8.0.0)
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20230519150216.2599189-1-eblake@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      43074635
  9. May 30, 2023
  10. May 25, 2023
    • Paolo Bonzini's avatar
      monitor: do not use mb_read/mb_set for suspend_cnt · 6ee7c82d
      Paolo Bonzini authored
      
      Clean up monitor_event to just use monitor_suspend/monitor_resume,
      using mon->mux_out to protect against incorrect nesting (especially
      on startup).
      
      The only remaining case of reading suspend_cnt is in the can_read
      callback, which is just advisory and can use qatomic_read.
      
      As an extra benefit, mux_out is now simply protected by mon_lock.
      Also, moving the prompt to the beginning of the main loop removes
      it from the output in some error cases where QEMU does not actually
      start successfully.  It is not a full fix and it would be nice to
      also remove the monitor heading, but this is already a small (though
      unintentional) improvement.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6ee7c82d
  11. May 22, 2023
  12. May 19, 2023
  13. May 18, 2023
  14. May 15, 2023
  15. May 10, 2023
  16. Apr 11, 2023
  17. Apr 04, 2023
  18. Mar 22, 2023
Loading