1. 25 9月, 2018 5 次提交
    • J
      block/rbd: add iotest for rbd legacy keyvalue filename parsing · 66e6a735
      Jeff Cody 提交于
      This is a small test that will check for the ability to parse
      both legacy and modern options for rbd.
      
      The way the test is set up is for failure to occur, but without
      having to wait to timeout on a non-existent rbd server.  The error
      messages in the success path show that the arguments were parsed.
      
      The failure behavior prior to the patch series that has this test, is
      qemu-img complaining about mandatory options (e.g. 'pool') not being
      provided.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Message-id: f830580e339b974a83ed4870d11adcdc17f49a47.1536704901.git.jcody@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      66e6a735
    • J
      block/rbd: Attempt to parse legacy filenames · 084d1d13
      Jeff Cody 提交于
      When we converted rbd to get rid of the older key/value-centric
      encoding format, we broke compatibility with image files with backing
      file strings encoded in the old format.
      
      This leaves a bit of an ugly conundrum, and a hacky solution.
      
      If the initial attempt to parse the "proper" options fails, it assumes
      that we may have an older key/value encoded filename.  Fall back to
      attempting to parse the filename, and extract the required options from
      it.  If that fails, pass along the original error message.
      
      We do not support mixed modern usage alongside legacy keyvalue pair
      usage.
      
      A deprecation warning has been added, although care should be taken
      when actually deprecating since the impact is not limited to
      commandline or qapi usage, but also opening existing images.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Message-id: 15b332e5432ad069441f7275a46080f465d789a0.1536704901.git.jcody@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      084d1d13
    • J
      block/rbd: pull out qemu_rbd_convert_options · f24b03b5
      Jeff Cody 提交于
      Code movement to pull the conversion from Qdict to BlockdevOptionsRbd
      into a helper function.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Message-id: 5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      f24b03b5
    • P
      Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-09-07-1' into staging · 741e1a61
      Peter Maydell 提交于
      Merge tpm 2018/09/07 v1
      
      # gpg: Signature made Fri 07 Sep 2018 21:38:06 BST
      # gpg:                using RSA key 75AD65802A0B4211
      # gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211
      
      * remotes/stefanberger/tags/pull-tpm-2018-09-07-1:
        tests: Fix signalling race condition in TPM tests
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      741e1a61
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.1-20180907' into staging · 9c36281b
      Peter Maydell 提交于
      ppc patch queue 2018-09-07
      
      Here's another pull request for qemu-3.1.  No real theme here, just an
      assortment of various fixes.  Probably the most notable thing is the
      removal of the ppcemb target which has been deprecated for some time
      now.
      
      # gpg: Signature made Fri 07 Sep 2018 08:30:02 BST
      # gpg:                using RSA key 6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-3.1-20180907:
        target-ppc: Extend HWCAP2 bits for ISA 3.0
        target/ppc/kvm: set vcpu as online/offline
        Fix a deadlock case in the CPU hotplug flow
        spapr: Correct reference count on spapr-cpu-core
        mac_newworld: implement custom FWPathProvider
        uninorth: add ofw-addr property to allow correct fw path generation
        mac_oldworld: implement custom FWPathProvider
        grackle: set device fw_name and address for correct fw path generation
        macio: add addr property to macio IDE object
        macio: add macio bus to help with fw path generation
        macio: move MACIOIDEState type declarations to macio.h
        spapr_pci: fix potential NULL pointer dereference
        spapr: fix leak of rev array
        ppc: Remove deprecated ppcemb target
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9c36281b
  2. 24 9月, 2018 9 次提交
    • P
      Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-pullreq-20180905' into staging · ee4402ea
      Peter Maydell 提交于
      A misc collection of RISC-V related patches for 3.1.
      
      # gpg: Signature made Wed 05 Sep 2018 23:06:55 BST
      # gpg:                using RSA key 21E10D29DF977054
      # gpg: Good signature from "Alistair Francis <alistair@alistair23.me>"
      # gpg: WARNING: This key is not certified with sufficiently trusted signatures!
      # gpg:          It is not certain that the signature belongs to the owner.
      # Primary key fingerprint: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054
      
      * remotes/alistair/tags/pull-riscv-pullreq-20180905:
        riscv: remove define cpu_init()
        hw/riscv/spike: Set the soc device tree node as a simple-bus
        hw/riscv/virtio: Set the soc device tree node as a simple-bus
        target/riscv: call gen_goto_tb on DISAS_TOO_MANY
        target/riscv: optimize indirect branches
        target/riscv: optimize cross-page direct jumps in softmmu
        RISC-V: Simplify riscv_cpu_local_irqs_pending
        RISC-V: Use atomic_cmpxchg to update PLIC bitmaps
        RISC-V: Improve page table walker spec compliance
        RISC-V: Update address bits to support sv39 and sv48
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ee4402ea
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180903-pull-request' into staging · d5a51573
      Peter Maydell 提交于
      vga: virtio reset fix, virtio iommu support.
      
      # gpg: Signature made Mon 03 Sep 2018 07:57:32 BST
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/vga-20180903-pull-request:
        virtio-gpu: add iommu support
        virtio-gpu: pass down VirtIOGPU pointer to a bunch of functions
        use dpy_gfx_update_full
        Revert "virtio-gpu: fix crashes upon warm reboot with vga mode"
        virtio-vga: fix reset
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d5a51573
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-09-01' into staging · efd1d522
      Peter Maydell 提交于
      Monitor patches for 2018-09-01
      
      # gpg: Signature made Sat 01 Sep 2018 12:06:52 BST
      # gpg:                using RSA key 3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-monitor-2018-09-01:
        monitor: no need to save need_resume
        Revert "qmp: isolate responses into io thread"
        qmp: constify qmp_is_oob()
        monitor: consitify qmp_send_response() QDict argument
        monitor: accept input on resume
        monitor: simplify monitor_qmp_setup_handlers_bh
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      efd1d522
    • P
      Merge remote-tracking branch 'remotes/xanclic/tags/pull-block-2018-08-31-v2' into staging · d6f71af6
      Peter Maydell 提交于
      Block patches:
      - (Block) job exit refactoring, part 1
        (removing job_defer_to_main_loop())
      - test-bdrv-drain leak fix
      
      # gpg: Signature made Fri 31 Aug 2018 15:30:33 BST
      # gpg:                using RSA key F407DB0061D5CF40
      # gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
      # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40
      
      * remotes/xanclic/tags/pull-block-2018-08-31-v2:
        jobs: remove job_defer_to_main_loop
        jobs: remove ret argument to job_completed; privatize it
        block/backup: make function variables consistently named
        jobs: utilize job_exit shim
        block/mirror: utilize job_exit shim
        block/commit: utilize job_exit shim
        jobs: add exit shim
        jobs: canonize Error object
        jobs: change start callback to run callback
        tests: fix bdrv-drain leak
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d6f71af6
    • P
      Revert "tests: add qmp/qom-set-without-value test" · 539c251b
      Peter Maydell 提交于
      Markus spotted some issues with this new test case which
      unfortunately I didn't notice had been flagged until after
      I'd applied the pull request. Revert the relevant commit.
      
      This reverts commit 2b70ea92.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      539c251b
    • P
      Merge remote-tracking branch... · 2dff7552
      Peter Maydell 提交于
      Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios.for-upstream-20180831' into staging
      
      qemu-openbios.for-upstream queue
      
      # gpg: Signature made Fri 31 Aug 2018 12:26:55 BST
      # gpg:                using RSA key 5BC2C56FAE0F321F
      # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"
      # Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F
      
      * remotes/mcayland/tags/qemu-openbios.for-upstream-20180831:
        Update OpenBIOS images to a1280807 built from submodule.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      2dff7552
    • P
      Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2018-08-31' into staging · 09d8277e
      Peter Maydell 提交于
      Removal of deprecated options and improvements for the qtests
      
      # gpg: Signature made Fri 31 Aug 2018 09:10:23 BST
      # gpg:                using RSA key 2ED9D774FE702DB5
      # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>"
      # gpg:                 aka "Thomas Huth <thuth@redhat.com>"
      # gpg:                 aka "Thomas Huth <huth@tuxfamily.org>"
      # gpg:                 aka "Thomas Huth <th.huth@posteo.de>"
      # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5
      
      * remotes/huth-gitlab/tags/pull-request-2018-08-31:
        tests: add a qmp success-response test
        tests: add qmp/qom-set-without-value test
        tests: add qmp/object-add-without-props test
        tests: add qmp_assert_error_class()
        tests/libqos: Utilize newer glib spawn check
        net: Remove the deprecated -tftp, -bootp, -redir and -smb options
        Remove the deprecated options -startdate, -localtime and -rtc-td-hack
        Remove the deprecated -nodefconfig option
        Remove the deprecated -balloon option
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      09d8277e
    • P
      Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180829' into staging · 2fde22f8
      Peter Maydell 提交于
      - various fixes and improvements in the tcg code
      - split off the individual virtio-ccw devices into separate files
      
      # gpg: Signature made Wed 29 Aug 2018 10:38:03 BST
      # gpg:                using RSA key DECF6B93C6F02FAF
      # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
      # gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
      # gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
      # gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck/tags/s390x-20180829:
        target/s390x: use regular spaces in translate.c
        hw/s390x: Move virtio-ccw-blk code to a separate file
        hw/s390x: Move virtio-ccw-net code to a separate file
        hw/s390x: Move virtio-ccw-input code to a separate file
        hw/s390x: Move virtio-ccw-gpu code to a separate file
        hw/s390x: Move vhost-vsock-ccw code to a separate file
        hw/s390x: Move virtio-ccw-crypto code to a separate file
        hw/s390x: Move virtio-ccw-9p code to a separate file
        hw/s390x: Move virtio-ccw-rng code to a separate file
        hw/s390x: Move virtio-ccw-scsi code to a separate file
        hw/s390x: Move virtio-ccw-balloon code to a separate file
        hw/s390x: Move virtio-ccw-serial code to a separate file
        hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
        target/s390x: fix PACK reading 1 byte less and writing 1 byte more
        target/s390x: add EX support for TRT and TRTR
        target/s390x: fix IPM polluting irrelevant bits
        target/s390x: fix CSST decoding and runtime alignment check
        target/s390x: add BAL and BALR instructions
        tests/tcg: add a simple s390x test
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      2fde22f8
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-08-28' into staging · 850a8242
      Peter Maydell 提交于
      QAPI patches for 2018-08-28
      
      # gpg: Signature made Tue 28 Aug 2018 17:23:32 BST
      # gpg:                using RSA key 3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-qapi-2018-08-28:
        qapi: Add comments to aid debugging generated introspection
        qapi: Minor introspect.py cleanups
        qapi: Update docs for generator changes since commit 9ee86b85
        qapi: Emit a blank line before dummy declaration
        qapi: Drop qapi_event_send_FOO()'s Error ** argument
        qapi: Fix build_params() for empty parameter list
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      850a8242
  3. 08 9月, 2018 1 次提交
  4. 07 9月, 2018 1 次提交
  5. 06 9月, 2018 6 次提交
  6. 05 9月, 2018 5 次提交
  7. 03 9月, 2018 3 次提交
    • G
      virtio-gpu: add iommu support · 8da132a5
      Gerd Hoffmann 提交于
      Switch from cpu_physical_memory_map to dma_memory_map,
      so iommu mappings for virtio-gpu objects work properly.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-Id: <20180829122101.29852-3-kraxel@redhat.com>
      8da132a5
    • G
      virtio-gpu: pass down VirtIOGPU pointer to a bunch of functions · 3bb68f79
      Gerd Hoffmann 提交于
      No functional change, just preparation for a followup patch
      which needs a VirtIOGPU pointer.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-Id: <20180829122101.29852-2-kraxel@redhat.com>
      3bb68f79
    • J
      Fix a deadlock case in the CPU hotplug flow · b12a4efb
      Jose Ricardo Ziviani 提交于
      We need to set cs->halted to 1 before calling ppc_set_compat. The reason
      is that ppc_set_compat kicks up the new thread created to manage the
      hotplugged KVM virtual CPU and the code drives directly to KVM_RUN
      ioctl. When cs->halted is 1, the code:
      
      int kvm_cpu_exec(CPUState *cpu)
      ...
           if (kvm_arch_process_async_events(cpu)) {
               atomic_set(&cpu->exit_request, 0);
               return EXCP_HLT;
           }
      ...
      
      returns before it reaches KVM_RUN, giving time to the main thread to
      finish its job. Otherwise we can fall in a deadlock because the KVM
      thread will issue the KVM_RUN ioctl while the main thread is setting up
      KVM registers. Depending on how these jobs are scheduled we'll end up
      freezing QEMU.
      
      The following output shows kvm_vcpu_ioctl sleeping because it cannot get
      the mutex and never will.
      PS: kvm_vcpu_ioctl was triggered kvm_set_one_reg - compat_pvr.
      
      STATE: TASK_UNINTERRUPTIBLE|TASK_WAKEKILL
      
      PID: 61564  TASK: c000003e981e0780  CPU: 48  COMMAND: "qemu-system-ppc"
       #0 [c000003e982679a0] __schedule at c000000000b10a44
       #1 [c000003e98267a60] schedule at c000000000b113a8
       #2 [c000003e98267a90] schedule_preempt_disabled at c000000000b11910
       #3 [c000003e98267ab0] __mutex_lock at c000000000b132ec
       #4 [c000003e98267bc0] kvm_vcpu_ioctl at c00800000ea03140 [kvm]
       #5 [c000003e98267d20] do_vfs_ioctl at c000000000407d30
       #6 [c000003e98267dc0] ksys_ioctl at c000000000408674
       #7 [c000003e98267e10] sys_ioctl at c0000000004086f8
       #8 [c000003e98267e30] system_call at c00000000000b488
      
      crash> struct -x kvm.vcpus 0xc000003da0000000
      vcpus = {0xc000003db4880000, 0xc000003d52b80000, 0xc0000039e9c80000, 0xc000003d0e200000, 0xc000003d58280000, 0x0, 0x0, ...}
      
      crash> struct -x kvm_vcpu.mutex.owner 0xc000003d58280000
        mutex.owner = {
          counter = 0xc000003a23a5c881 <- flag 1: waiters
        },
      
      crash> bt 0xc000003a23a5c880
      PID: 61579  TASK: c000003a23a5c880  CPU: 9   COMMAND: "CPU 4/KVM"
      (active)
      
      crash> struct -x kvm_vcpu.mutex.wait_list 0xc000003d58280000
        mutex.wait_list = {
          next = 0xc000003e98267b10,
          prev = 0xc000003e98267b10
        },
      
      crash> struct -x mutex_waiter.task 0xc000003e98267b10
        task = 0xc000003e981e0780
      
      The following command-line was used to reproduce the problem (note: gdb
      and trace can change the results).
      
       $ qemu-ppc/build/ppc64-softmmu/qemu-system-ppc64 -cpu host \
           -enable-kvm -m 4096 \
           -smp 4,maxcpus=8,sockets=1,cores=2,threads=4 \
           -display none -nographic \
           -drive file=disk1.qcow2,format=qcow2
       ...
       (qemu) device_add host-spapr-cpu-core,core-id=4
      [no interaction is possible after it, only SIGKILL to take the terminal
      back]
      Signed-off-by: NJose Ricardo Ziviani <joserz@linux.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b12a4efb
  8. 31 8月, 2018 10 次提交
    • J
      jobs: remove job_defer_to_main_loop · e21a1c98
      John Snow 提交于
      Now that the job infrastructure is handling the job_completed call for
      all implemented jobs, we can remove the interface that allowed jobs to
      schedule their own completion.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-10-jsnow@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      e21a1c98
    • J
      jobs: remove ret argument to job_completed; privatize it · 404ff28d
      John Snow 提交于
      Jobs are now expected to return their retcode on the stack, from the
      .run callback, so we can remove that argument.
      
      job_cancel does not need to set -ECANCELED because job_completed will
      update the return code itself if the job was canceled.
      
      While we're here, make job_completed static to job.c and remove it from
      job.h; move the documentation of return code to the .run() callback and
      to the job->ret property, accordingly.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 20180830015734.19765-9-jsnow@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      404ff28d
    • J
      block/backup: make function variables consistently named · 68702775
      John Snow 提交于
      Rename opaque_job to job to be consistent with other job implementations.
      Rename 'job', the BackupBlockJob object, to 's' to also be consistent.
      Suggested-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-8-jsnow@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      68702775
    • J
      jobs: utilize job_exit shim · eb23654d
      John Snow 提交于
      Utilize the job_exit shim by not calling job_defer_to_main_loop, and
      where applicable, converting the deferred callback into the job_exit
      callback.
      
      This converts backup, stream, create, and the unit tests all at once.
      Most of these jobs do not see any changes to the order in which they
      clean up their resources, except the test-blockjob-txn test, which
      now puts down its bs before job_completed is called.
      
      This is safe for the same reason the reordering in the mirror job is
      safe, because job_completed no longer runs under two locks, making
      the unref safe even if it causes a flush.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-7-jsnow@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      eb23654d
    • J
      block/mirror: utilize job_exit shim · 7b508f6b
      John Snow 提交于
      Change the manual deferment to mirror_exit into the implicit
      callback to job_exit and the mirror_exit callback.
      
      This does change the order of some bdrv_unref calls and job_completed,
      but thanks to the new context in which we call .exit, this is safe to
      defer the possible flushing of any nodes to the job_finalize_single
      cleanup stage.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 20180830015734.19765-6-jsnow@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      7b508f6b
    • J
      block/commit: utilize job_exit shim · f369b48d
      John Snow 提交于
      Change the manual deferment to commit_complete into the implicit
      callback to job_exit, renaming commit_complete to commit_exit.
      
      This conversion does change the timing of when job_completed is
      called to after the bdrv_replace_node and bdrv_unref calls, which
      could have implications for bjob->blk which will now be put down
      after this cleanup.
      
      Kevin highlights that we did not take any permissions for that backend
      at job creation time, so it is safe to reorder these operations.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-5-jsnow@redhat.com
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f369b48d
    • J
      jobs: add exit shim · 00359a71
      John Snow 提交于
      All jobs do the same thing when they leave their running loop:
      - Store the return code in a structure
      - wait to receive this structure in the main thread
      - signal job completion via job_completed
      
      Few jobs do anything beyond exactly this. Consolidate this exit
      logic for a net reduction in SLOC.
      
      More seriously, when we utilize job_defer_to_main_loop_bh to call
      a function that calls job_completed, job_finalize_single will run
      in a context where it has recursively taken the aio_context lock,
      which can cause hangs if it puts down a reference that causes a flush.
      
      You can observe this in practice by looking at mirror_exit's careful
      placement of job_completed and bdrv_unref calls.
      
      If we centralize job exiting, we can signal job completion from outside
      of the aio_context, which should allow for job cleanup code to run with
      only one lock, which makes cleanup callbacks less tricky to write.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-4-jsnow@redhat.com
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      00359a71
    • J
      jobs: canonize Error object · 3d1f8b07
      John Snow 提交于
      Jobs presently use both an Error object in the case of the create job,
      and char strings in the case of generic errors elsewhere.
      
      Unify the two paths as just j->err, and remove the extra argument from
      job_completed. The integer error code for job_completed is kept for now,
      to be removed shortly in a separate patch.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 20180830015734.19765-3-jsnow@redhat.com
      [mreitz: Dropped a superfluous g_strdup()]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      3d1f8b07
    • J
      jobs: change start callback to run callback · f67432a2
      John Snow 提交于
      Presently we codify the entry point for a job as the "start" callback,
      but a more apt name would be "run" to clarify the idea that when this
      function returns we consider the job to have "finished," except for
      any cleanup which occurs in separate callbacks later.
      
      As part of this clarification, change the signature to include an error
      object and a return code. The error ptr is not yet used, and the return
      code while captured, will be overwritten by actions in the job_completed
      function.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-2-jsnow@redhat.com
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f67432a2
    • M
      tests: fix bdrv-drain leak · 7b43db3c
      Marc-André Lureau 提交于
      Spotted by ASAN:
      
      =================================================================
      ==5378==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 65536 byte(s) in 1 object(s) allocated from:
          #0 0x7f788f83bc48 in malloc (/lib64/libasan.so.5+0xeec48)
          #1 0x7f788c9923c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
          #2 0x5622a1fe37bc in coroutine_trampoline /home/elmarco/src/qq/util/coroutine-ucontext.c:116
          #3 0x7f788a15d75f in __correctly_grouped_prefixwc (/lib64/libc.so.6+0x4c75f)
      
      (Broken in commit 4c8158e3.)
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20180809114417.28718-3-marcandre.lureau@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      7b43db3c