Skip to content
Snippets Groups Projects
  1. Sep 24, 2019
    • Eric Blake's avatar
      nbd: Grab aio context lock in more places · 61bc846d
      Eric Blake authored
      
      When iothreads are in use, the failure to grab the aio context results
      in an assertion failure when trying to unlock things during blk_unref,
      when trying to unlock a mutex that was not locked.  In short, all
      calls to nbd_export_put need to done while within the correct aio
      context.  But since nbd_export_put can recursively reach itself via
      nbd_export_close, and recursively grabbing the context would deadlock,
      we can't do the context grab directly in those functions, but must do
      so in their callers.
      
      Hoist the use of the correct aio_context from nbd_export_new() to its
      caller qmp_nbd_server_add().  Then tweak qmp_nbd_server_remove(),
      nbd_eject_notifier(), and nbd_esport_close_all() to grab the right
      context, so that all callers during qemu now own the context before
      nbd_export_put() can call blk_unref().
      
      Remaining uses in qemu-nbd don't matter (since that use case does not
      support iothreads).
      
      Suggested-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20190917023917.32226-1-eblake@redhat.com>
      Reviewed-by: default avatarSergio Lopez <slp@redhat.com>
      61bc846d
    • Sergio Lopez's avatar
      nbd/server: attach client channel to the export's AioContext · b4961249
      Sergio Lopez authored
      On creation, the export's AioContext is set to the same one as the
      BlockBackend, while the AioContext in the client QIOChannel is left
      untouched.
      
      As a result, when using data-plane, nbd_client_receive_next_request()
      schedules coroutines in the IOThread AioContext, while the client's
      QIOChannel is serviced from the main_loop, potentially triggering the
      assertion at qio_channel_restart_[read|write].
      
      To fix this, as soon we have the export corresponding to the client,
      we call qio_channel_attach_aio_context() to attach the QIOChannel
      context to the export's AioContext. This matches with the logic at
      blk_aio_attached().
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1748253
      
      
      Signed-off-by: default avatarSergio Lopez <slp@redhat.com>
      Message-Id: <20190912110032.26395-1-slp@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      b4961249
    • Eric Blake's avatar
      nbd/client: Add hint when TLS is missing · 1b5c15ce
      Eric Blake authored
      
      I received an off-list report of failure to connect to an NBD server
      expecting an x509 certificate, when the client was attempting something
      similar to this command line:
      
      $ ./x86_64-softmmu/qemu-system-x86_64 -name 'blah' -machine q35 -nodefaults \
        -object tls-creds-x509,id=tls0,endpoint=client,dir=$path_to_certs \
        -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie.0,addr=0x6 \
        -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=raw,file=nbd:localhost:9000,werror=stop,rerror=stop,tls-creds=tls0 \
        -device scsi-hd,id=image1,drive=drive_image1,bootindex=0
      qemu-system-x86_64: -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=raw,file=nbd:localhost:9000,werror=stop,rerror=stop,tls-creds=tls0: TLS negotiation required before option 7 (go)
      server reported: Option 0x7 not permitted before TLS
      
      The problem?  As specified, -drive is trying to pass tls-creds to the
      raw format driver instead of the nbd protocol driver, but before we
      get to the point where we can detect that raw doesn't know what to do
      with tls-creds, the nbd driver has already failed because the server
      complained.  The fix to the broken command line?  Pass
      '...,file.tls-creds=tls0' to ensure the tls-creds option is handed to
      nbd, not raw.  But since the error message was rather cryptic, I'm
      trying to improve the error message.
      
      With this patch, the error message adds a line:
      
      qemu-system-x86_64: -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=raw,file=nbd:localhost:9000,werror=stop,rerror=stop,tls-creds=tls0: TLS negotiation required before option 7 (go)
      Did you forget a valid tls-creds?
      server reported: Option 0x7 not permitted before TLS
      
      And with luck, someone grepping for that error message will find this
      commit message and figure out their command line mistake.  Sadly, the
      only mention of file.tls-creds in our docs relates to an --image-opts
      use of PSK encryption with qemu-img as the client, rather than x509
      certificate encryption with qemu-kvm as the client.
      
      CC: Tingting Mao <timao@redhat.com>
      CC: Daniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20190907172055.26870-1-eblake@redhat.com>
      [eblake: squash in iotest 233 fix]
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      1b5c15ce
  2. Sep 23, 2019
  3. Sep 20, 2019
    • Corey Minyard's avatar
      pc: Add an SMB0 ACPI device to q35 · ebe15582
      Corey Minyard authored
      
      This is so I2C devices can be found in the ACPI namespace.  Currently
      that's only IPMI, but devices can be easily added now.
      
      Adding the devices required some PCI information, and the bus itself
      to be added to the PCMachineState structure.
      
      Note that this only works on Q35, the ACPI for PIIX4 is not capable
      of handling an SMBus device.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ebe15582
Loading