Skip to content
Snippets Groups Projects
  1. Dec 13, 2020
  2. Dec 12, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · ad717e6d
      Peter Maydell authored
      
      Block layer patches:
      
      - Support for FUSE exports
      - Fix deadlock in bdrv_co_yield_to_drain()
      - Use lock guard macros
      - Some preparational patches for 64 bit block layer
      - file-posix: Fix request extension to INT64_MAX in raw_do_pwrite_zeroes()
      
      # gpg: Signature made Fri 11 Dec 2020 17:06:19 GMT
      # gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
      # gpg:                issuer "kwolf@redhat.com"
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream: (34 commits)
        block: Fix deadlock in bdrv_co_yield_to_drain()
        block: Fix locking in qmp_block_resize()
        block: Simplify qmp_block_resize() error paths
        block: introduce BDRV_MAX_LENGTH
        block/io: bdrv_check_byte_request(): drop bdrv_is_inserted()
        block/io: bdrv_refresh_limits(): use ERRP_GUARD
        block/file-posix: fix workaround in raw_do_pwrite_zeroes()
        can-host: Fix crash when 'canbus' property is not set
        iotests/221: Discard image before qemu-img map
        file-posix: check the use_lock before setting the file lock
        iotests/308: Add test for FUSE exports
        iotests: Enable fuse for many tests
        iotests: Allow testing FUSE exports
        iotests: Give access to the qemu-storage-daemon
        storage-daemon: Call bdrv_close_all() on exit
        iotests/287: Clean up subshell test image
        iotests: Let _make_test_img guess $TEST_IMG_FILE
        iotests: Restrict some Python tests to file
        iotests/091: Use _cleanup_qemu instad of "wait"
        iotests: Derive image names from $TEST_IMG
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      ad717e6d
  3. Dec 11, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20201211' into staging · a4b307b0
      Peter Maydell authored
      
      First set of 6.0 patches for s390x:
      - acceptance test for device detection
      - bugfixes
      
      # gpg: Signature made Fri 11 Dec 2020 12:21:45 GMT
      # gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
      # gpg:                issuer "cohuck@redhat.com"
      # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
      # gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
      # gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck/tags/s390x-20201211:
        s390x/cpu: Use timer_free() in the finalize function to avoid memleaks
        tests/acceptance: test s390x zpci fid propagation
        tests/acceptance: verify s390x device detection
        tests/acceptance: test virtio-ccw revision handling
        tests/acceptance: add a test for devices on s390x
        hw/watchdog/wdt_diag288: Remove unnecessary includes
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      a4b307b0
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201211-pull-request' into staging · f6029bb6
      Peter Maydell authored
      
      ui/console ui_info tweaks.
      ui/vnc: alpha cursor support.
      ui/vnc: locking fixes.
      ui/sdl: add extra mouse buttons.
      
      # gpg: Signature made Fri 11 Dec 2020 09:12:39 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/ui-20201211-pull-request:
        sdl2: Add extra mouse buttons
        ui/vnc: Add missing lock for send_color_map
        vnc: add alpha cursor support
        vnc: add pseudo encodings
        vnc: drop unused copyrect feature
        vnc: use enum for features
        console: allow con==NULL in dpy_{get, set}_ui_info and dpy_ui_info_supported
        console: drop qemu_console_get_ui_info
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      f6029bb6
    • Kevin Wolf's avatar
      block: Fix deadlock in bdrv_co_yield_to_drain() · 960d5fb3
      Kevin Wolf authored
      If bdrv_co_yield_to_drain() is called for draining a block node that
      runs in a different AioContext, it keeps that AioContext locked while it
      yields and schedules a BH in the AioContext to do the actual drain.
      
      As long as executing the BH is the very next thing that the event loop
      of the node's AioContext does, this actually happens to work, but when
      it tries to execute something else that wants to take the AioContext
      lock, it will deadlock. (In the bug report, this other thing is a
      virtio-scsi device running virtio_scsi_data_plane_handle_cmd().)
      
      Instead, always drop the AioContext lock across the yield and reacquire
      it only when the coroutine is reentered. The BH needs to unconditionally
      take the lock for itself now.
      
      This fixes the 'block_resize' QMP command on a block node that runs in
      an iothread.
      
      Cc: qemu-stable@nongnu.org
      Fixes: eb94b81a
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1903511
      
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201203172311.68232-4-kwolf@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      960d5fb3
    • Kevin Wolf's avatar
      block: Fix locking in qmp_block_resize() · 8089eab2
      Kevin Wolf authored
      
      The drain functions assume that we hold the AioContext lock of the
      drained block node. Make sure to actually take the lock.
      
      Cc: qemu-stable@nongnu.org
      Fixes: eb94b81a
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201203172311.68232-3-kwolf@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      8089eab2
    • Kevin Wolf's avatar
      block: Simplify qmp_block_resize() error paths · d9dbf25f
      Kevin Wolf authored
      
      The only thing that happens after the 'out:' label is blk_unref(blk).
      However, blk = NULL in all of the error cases, so instead of jumping to
      'out:', we can just return directly.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201203172311.68232-2-kwolf@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      d9dbf25f
    • Vladimir Sementsov-Ogievskiy's avatar
      block: introduce BDRV_MAX_LENGTH · 8b117001
      Vladimir Sementsov-Ogievskiy authored
      
      We are going to modify block layer to work with 64bit requests. And
      first step is moving to int64_t type for both offset and bytes
      arguments in all block request related functions.
      
      It's mostly safe (when widening signed or unsigned int to int64_t), but
      switching from uint64_t is questionable.
      
      So, let's first establish the set of requests we want to work with.
      First signed int64_t should be enough, as off_t is signed anyway. Then,
      obviously offset + bytes should not overflow.
      
      And most interesting: (offset + bytes) being aligned up should not
      overflow as well. Aligned to what alignment? First thing that comes in
      mind is bs->bl.request_alignment, as we align up request to this
      alignment. But there is another thing: look at
      bdrv_mark_request_serialising(). It aligns request up to some given
      alignment. And this parameter may be bdrv_get_cluster_size(), which is
      often a lot greater than bs->bl.request_alignment.
      Note also, that bdrv_mark_request_serialising() uses signed int64_t for
      calculations. So, actually, we already depend on some restrictions.
      
      Happily, bdrv_get_cluster_size() returns int and
      bs->bl.request_alignment has 32bit unsigned type, but defined to be a
      power of 2 less than INT_MAX. So, we may establish, that INT_MAX is
      absolute maximum for any kind of alignment that may occur with the
      request.
      
      Note, that bdrv_get_cluster_size() is not documented to return power
      of 2, still bdrv_mark_request_serialising() behaves like it is.
      Also, backup uses bdi.cluster_size and is not prepared to it not being
      power of 2.
      So, let's establish that Qemu supports only power-of-2 clusters and
      alignments.
      
      So, alignment can't be greater than 2^30.
      
      Finally to be safe with calculations, to not calculate different
      maximums for different nodes (depending on cluster size and
      request_alignment), let's simply set QEMU_ALIGN_DOWN(INT64_MAX, 2^30)
      as absolute maximum bytes length for Qemu. Actually, it's not much less
      than INT64_MAX.
      
      OK, then, let's apply it to block/io.
      
      Let's consider all block/io entry points of offset/bytes:
      
      4 bytes/offset interface functions: bdrv_co_preadv_part(),
      bdrv_co_pwritev_part(), bdrv_co_copy_range_internal() and
      bdrv_co_pdiscard() and we check them all with bdrv_check_request().
      
      We also have one entry point with only offset: bdrv_co_truncate().
      Check the offset.
      
      And one public structure: BdrvTrackedRequest. Happily, it has only
      three external users:
      
       file-posix.c: adopted by this patch
       write-threshold.c: only read fields
       test-write-threshold.c: sets obviously small constant values
      
      Better is to make the structure private and add corresponding
      interfaces.. Still it's not obvious what kind of interface is needed
      for file-posix.c. Let's keep it public but add corresponding
      assertions.
      
      After this patch we'll convert functions in block/io.c to int64_t bytes
      and offset parameters. We can assume that offset/bytes pair always
      satisfy new restrictions, and make
      corresponding assertions where needed. If we reach some offset/bytes
      point in block/io.c missing bdrv_check_request() it is considered a
      bug. As well, if block/io.c modifies a offset/bytes request, expanding
      it more then aligning up to request_alignment, it's a bug too.
      
      For all io requests except for discard we keep for now old restriction
      of 32bit request length.
      
      iotest 206 output error message changed, as now test disk size is
      larger than new limit. Add one more test case with new maximum disk
      size to cover too-big-L1 case.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20201203222713.13507-5-vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      8b117001
    • Vladimir Sementsov-Ogievskiy's avatar
      block/io: bdrv_check_byte_request(): drop bdrv_is_inserted() · f4dad307
      Vladimir Sementsov-Ogievskiy authored
      
      Move bdrv_is_inserted() calls into callers.
      
      We are going to make bdrv_check_byte_request() a clean thing.
      bdrv_is_inserted() is not about checking the request, it's about
      checking the bs. So, it should be separate.
      
      With this patch we probably change error path for some failure
      scenarios. But depending on the fact that querying too big request on
      empty cdrom (or corrupted qcow2 node with no drv) will result in EIO
      and not ENOMEDIUM would be very strange. More over, we are going to
      move to 64bit requests, so larger requests will be allowed anyway.
      
      More over, keeping in mind that cdrom is the only driver that has
      .bdrv_is_inserted() handler it's strange that we should care so much
      about it in generic block layer, intuitively we should just do read and
      write, and cdrom driver should return correct errors if it is not
      inserted. But it's a work for another series.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20201203222713.13507-4-vsementsov@virtuozzo.com>
      Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      f4dad307
    • Vladimir Sementsov-Ogievskiy's avatar
      block/io: bdrv_refresh_limits(): use ERRP_GUARD · 33985614
      Vladimir Sementsov-Ogievskiy authored
      
      This simplifies following commit.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20201203222713.13507-3-vsementsov@virtuozzo.com>
      Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      33985614
    • Vladimir Sementsov-Ogievskiy's avatar
      block/file-posix: fix workaround in raw_do_pwrite_zeroes() · 9b100af3
      Vladimir Sementsov-Ogievskiy authored
      
      We should not set overlap_bytes:
      
      1. Don't worry: it is calculated by bdrv_mark_request_serialising() and
         will be equal to or greater than bytes anyway.
      
      2. If the request was already aligned up to some greater alignment,
         than we may break things: we reduce overlap_bytes, and further
         bdrv_mark_request_serialising() may not help, as it will not restore
         old bigger alignment.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20201203222713.13507-2-vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      9b100af3
    • Kevin Wolf's avatar
      can-host: Fix crash when 'canbus' property is not set · 7cc25f6c
      Kevin Wolf authored
      
      Providing the 'if' property, but not 'canbus' segfaults like this:
      
       #0  0x0000555555b0f14d in can_bus_insert_client (bus=0x0, client=0x555556aa9af0) at ../net/can/can_core.c:88
       #1  0x00005555559c3803 in can_host_connect (ch=0x555556aa9ac0, errp=0x7fffffffd568) at ../net/can/can_host.c:62
       #2  0x00005555559c386a in can_host_complete (uc=0x555556aa9ac0, errp=0x7fffffffd568) at ../net/can/can_host.c:72
       #3  0x0000555555d52de9 in user_creatable_complete (uc=0x555556aa9ac0, errp=0x7fffffffd5c8) at ../qom/object_interfaces.c:23
      
      Add the missing NULL check.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201130105615.21799-5-kwolf@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      7cc25f6c
    • Hanna Reitz's avatar
      iotests/221: Discard image before qemu-img map · f0947dc6
      Hanna Reitz authored
      
      See the new comment for why this should be done.
      
      I do not have a reproducer on master, but when using FUSE block exports,
      this test breaks depending on the underlying filesystem (for me, it
      works on tmpfs, but fails on xfs, because the block allocated by
      file-posix has 16 kB there instead of 4 kB).
      
      Suggested-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-Id: <20201207152245.66987-1-mreitz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      f0947dc6
    • Li Feng's avatar
      file-posix: check the use_lock before setting the file lock · eb43ea16
      Li Feng authored
      
      The scenario is that when accessing a volume on an NFS filesystem
      without supporting the file lock,  Qemu will complain "Failed to lock
      byte 100", even when setting the file.locking = off.
      
      We should do file lock related operations only when the file.locking is
      enabled, otherwise, the syscall of 'fcntl' will return non-zero.
      
      Signed-off-by: default avatarLi Feng <fengli@smartx.com>
      Message-Id: <1607341446-85506-1-git-send-email-fengli@smartx.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      eb43ea16
    • Hanna Reitz's avatar
      iotests/308: Add test for FUSE exports · e6c79647
      Hanna Reitz authored
      
      We have good coverage of the normal I/O paths now, but what remains is a
      test that tests some more special cases: Exporting an image on itself
      (thus turning a formatted image into a raw one), some error cases, and
      non-writable and non-growable exports.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201027190600.192171-21-mreitz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      e6c79647
Loading