1. 15 8月, 2018 1 次提交
    • K
      mirror: Fail gracefully for source == target · 86fae10c
      Kevin Wolf 提交于
      blockdev-mirror with the same node for source and target segfaults
      today: A node is in its own backing chain, so mirror_start_job() decides
      that this is an active commit. When adding the intermediate nodes with
      block_job_add_bdrv(), it starts the iteration through the subchain with
      the backing file of source, though, so it never reaches target and
      instead runs into NULL at the base.
      
      While we could fix that by starting with source itself, there is no
      point in allowing mirroring a node into itself and I wouldn't be
      surprised if this caused more problems later.
      
      So just check for this scenario and error out.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      86fae10c
  2. 10 7月, 2018 1 次提交
    • F
      block: Use BdrvChild to discard · 0b9fd3f4
      Fam Zheng 提交于
      Other I/O functions are already using a BdrvChild pointer in the API, so
      make discard do the same. It makes it possible to initiate the same
      permission checks before doing I/O, and much easier to share the
      helper functions for this, which will be added and used by write,
      truncate and copy range paths.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0b9fd3f4
  3. 18 6月, 2018 9 次提交
  4. 30 5月, 2018 1 次提交
    • K
      job: Add error message for failing jobs · 1266c9b9
      Kevin Wolf 提交于
      So far we relied on job->ret and strerror() to produce an error message
      for failed jobs. Not surprisingly, this tends to result in completely
      useless messages.
      
      This adds a Job.error field that can contain an error string for a
      failing job, and a parameter to job_completed() that sets the field. As
      a default, if NULL is passed, we continue to use strerror(job->ret).
      
      All existing callers are changed to pass NULL. They can be improved in
      separate patches.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      1266c9b9
  5. 23 5月, 2018 18 次提交
  6. 15 5月, 2018 5 次提交
  7. 08 5月, 2018 2 次提交
    • M
      block/mirror: Make cancel always cancel pre-READY · eb36639f
      Max Reitz 提交于
      Commit b76e4458 made the mirror block
      job respect block-job-cancel's @force flag: With that flag set, it would
      now always really cancel, even post-READY.
      
      Unfortunately, it had a side effect: Without that flag set, it would now
      never cancel, not even before READY.  Considering that is an
      incompatible change and not noted anywhere in the commit or the
      description of block-job-cancel's @force parameter, this seems
      unintentional and we should revert to the previous behavior, which is to
      immediately cancel the job when block-job-cancel is called before source
      and target are in sync (i.e. before the READY event).
      
      Cc: qemu-stable@nongnu.org
      Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1572856Reported-by: NYanan Fu <yfu@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20180501220509.14152-2-mreitz@redhat.com
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      eb36639f
    • S
      block/mirror: honor ratelimit again · ddc4115e
      Stefan Hajnoczi 提交于
      Commit b76e4458 ("block/mirror: change
      the semantic of 'force' of block-job-cancel") accidentally removed the
      ratelimit in the mirror job.
      
      Reintroduce the ratelimit but keep the block-job-cancel force=true
      behavior that was added in commit
      b76e4458.
      
      Note that block_job_sleep_ns() returns immediately when the job is
      cancelled.  Therefore it's safe to unconditionally call
      block_job_sleep_ns() - a cancelled job does not sleep.
      
      This commit fixes the non-deterministic qemu-iotests 185 output.  The
      test relies on the ratelimit to make the job sleep until the 'quit'
      command is processed.  Previously the job could complete before the
      'quit' command was received since there was no ratelimit.
      
      Cc: Liang Li <liliang.opensource@gmail.com>
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 20180424123527.19168-1-stefanha@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      ddc4115e
  8. 19 3月, 2018 2 次提交
    • L
      block/mirror: change the semantic of 'force' of block-job-cancel · b76e4458
      Liang Li 提交于
      When doing drive mirror to a low speed shared storage, if there was heavy
      BLK IO write workload in VM after the 'ready' event, drive mirror block job
      can't be canceled immediately, it would keep running until the heavy BLK IO
      workload stopped in the VM.
      
      Libvirt depends on the current block-job-cancel semantics, which is that
      when used without a flag after the 'ready' event, the command blocks
      until data is in sync.  However, these semantics are awkward in other
      situations, for example, people may use drive mirror for realtime
      backups while still wanting to use block live migration.  Libvirt cannot
      start a block live migration while another drive mirror is in progress,
      but the user would rather abandon the backup attempt as broken and
      proceed with the live migration than be stuck waiting for the current
      drive mirror backup to finish.
      
      The drive-mirror command already includes a 'force' flag, which libvirt
      does not use, although it documented the flag as only being useful to
      quit a job which is paused.  However, since quitting a paused job has
      the same effect as abandoning a backup in a non-paused job (namely, the
      destination file is not in sync, and the command completes immediately),
      we can just improve the documentation to make the force flag obviously
      useful.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: John Snow <jsnow@redhat.com>
      Reported-by: NHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: NHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: NLiang Li <liliangleo@didichuxing.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b76e4458
    • J
      blockjobs: model single jobs as transactions · 75859b94
      John Snow 提交于
      model all independent jobs as single job transactions.
      
      It's one less case we have to worry about when we add more states to the
      transition machine. This way, we can just treat all job lifetimes exactly
      the same. This helps tighten assertions of the STM graph and removes some
      conditionals that would have been needed in the coming commits adding a
      more explicit job lifetime management API.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      75859b94
  9. 03 3月, 2018 1 次提交