1. 15 7月, 2018 2 次提交
    • L
      linux-user: convert remaining fcntl() to safe_fcntl() · af8ab2bf
      Laurent Vivier 提交于
      Commit 435da5e7 didn't convert a fcntl() call to safe_fcntl()
      for TARGET_NR_fcntl64 case. There is no reason to not use it
      in this case.
      
      Fixes: 435da5e7 linux-user: Use safe_syscall wrapper for fcntl
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      Message-Id: <20180713125805.10749-1-laurent@vivier.eu>
      af8ab2bf
    • S
      linux-user: ppc64: use the correct values for F_*LK64s · 4a545761
      Shivaprasad G Bhat 提交于
      Qemu includes the glibc headers for the host defines and target headers are
      part of the qemu source themselves. The glibc has the F_GETLK64, F_SETLK64
      and F_SETLKW64 defined to 12, 13 and 14 for all archs in
      sysdeps/unix/sysv/linux/bits/fcntl-linux.h. The linux kernel generic
      definition for F_*LK is 5, 6 & 7 and F_*LK64* is 12,13, and 14 as seen in
      include/uapi/asm-generic/fcntl.h. On 64bit machine, by default the kernel
      assumes all F_*LK to 64bit calls and doesnt support use of F_*LK64* as
      can be seen in include/linux/fcntl.h in linux source.
      
      On x86_64 host, the values for F_*LK64* are set to 5, 6 and 7
      explicitly in /usr/include/x86_64-linux-gnu/bits/fcntl.h by the glibc.
      Whereas, a PPC64 host doesn't have such a definition in
      /usr/include/powerpc64le-linux-gnu/bits/fcntl.h by the glibc. So,
      the sources on PPC64 host sees the default value of F_*LK64*
      as 12, 13 & 14(fcntl-linux.h).
      
      Since the 64bit kernel doesnt support 12, 13 & 14; the glibc fcntl syscall
      implementation(__libc_fcntl*(), __fcntl64_nocancel) does the F_*LK64* value
      convertion back to F_*LK* values on PPC64 as seen in
      sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h with FCNTL_ADJUST_CMD()
      macro. Whereas on x86_64 host the values for F_*LK64* are set to 5, 6 and 7
      and no adjustments are needed.
      
      Since qemu doesnt use the glibc fcntl, but makes the safe_syscall* on its
      own, the PPC64 qemu is calling the syscall with 12, 13, and 14(without
      adjustment) and they all fail. The fcntl calls to F_GETLK/F_SETLK|W all
      fail by all pplications run on PPC64 host user emulation.
      
      The fix here could be to see why on PPC64 the glibc is still keeping
      F_*LK64* different from F_*LK and why adjusting them to 5, 6 and 7 before
      the syscall for PPC only. See if we can make the
      /usr/include/powerpc64le-linux-gnu/bits/fcntl.h to have the values
      5, 6 & 7 just like x86_64 and remove the adjustment code in glibc. That
      way, qemu sources see the kernel supported values in glibc headers.
      
      OR
      
      On PPC64 host, qemu sources see both F_*LK & F_*LK64* as same and set to
      12, 13 and 14 because __USE_FILE_OFFSET64 is defined in qemu
      sources(also refer sysdeps/unix/sysv/linux/bits/fcntl-linux.h).
      Do the value adjustment just like it is done by glibc source by using
      F_GETLK value of 5. That way, we make the syscalls with the actual
      supported values in Qemu. The patch is taking this approach.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Message-Id: <153148521235.87746.14142430397318741182.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      4a545761
  2. 13 7月, 2018 9 次提交
    • V
      docs: Grammar and spelling fixes · 9277d81f
      Ville Skyttä 提交于
      Signed-off-by: NVille Skyttä <ville.skytta@iki.fi>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20180612065150.21110-1-ville.skytta@iki.fi
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9277d81f
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 68f1b569
      Peter Maydell 提交于
      Block layer patches:
      
      - file-posix: Check correct file type (regular file for 'file',
        character or block device for 'host_device'/'host_cdrom')
      - scsi-disk: Block Device Characteristics emulation fix
      - qemu-img: Consider required alignment for sparse area detection
      - Documentation and test improvements
      
      # gpg: Signature made Thu 12 Jul 2018 17:29:17 BST
      # gpg:                using RSA key 7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        qemu-img: align result of is_allocated_sectors
        scsi-disk: Block Device Characteristics emulation fix
        iotests: add test 226 for file driver types
        file-posix: specify expected filetypes
        qemu-img: Document copy offloading implications with -S and -c
        iotests: nbd: Stop qemu-nbd before remaking image
        iotests: 153: Fix dead code
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      68f1b569
    • P
      qemu-img: align result of is_allocated_sectors · 8dcd3c9b
      Peter Lieven 提交于
      We currently don't enforce that the sparse segments we detect during convert are
      aligned. This leads to unnecessary and costly read-modify-write cycles either
      internally in Qemu or in the background on the storage device as nearly all
      modern filesystems or hardware have a 4k alignment internally.
      
      This patch modifies is_allocated_sectors so that its *pnum result will always
      end at an alignment boundary. This way all requests will end at an alignment
      boundary. The start of all requests will also be aligned as long as the results
      of get_block_status do not lead to an unaligned offset.
      
      The number of RMW cycles when converting an example image [1] to a raw device that
      has 4k sector size is about 4600 4k read requests to perform a total of about 15000
      write requests. With this path the additional 4600 read requests are eliminated while
      the number of total write requests stays constant.
      
      [1] https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.vmdkSigned-off-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      8dcd3c9b
    • D
      scsi-disk: Block Device Characteristics emulation fix · 740842c9
      Daniel Henrique Barboza 提交于
      The current BDC VPD page (page 0xb1) is too short. This can be
      seen running sg_utils:
      
      $ sg_vpd --page=bdc /dev/sda
      Block device characteristics VPD page (SBC):
      Block device characteristics VPD page length too short=8
      
      By the SCSI spec, the expected size of the SBC page is 0x40.
      There is no telling how the guest will behave with a shorter
      message - it can ignore it, or worse, make (wrong)
      assumptions.
      
      This patch fixes the emulation by setting the size to 0x40.
      This is the output of the previous sg_vpd command after
      applying it:
      
      $ sg_vpd --page=bdc /dev/sda -v
          inquiry cdb: 12 01 b1 00 fc 00
      Block device characteristics VPD page (SBC):
         [PQual=0  Peripheral device type: disk]
        Medium rotation rate is not reported
        Product type: Not specified
        WABEREQ=0
        WACEREQ=0
        Nominal form factor not reported
        FUAB=0
        VBULS=0
      
      To improve readability, this patch also adds the VBULS value
      explictly and add comments on the existing fields we're
      setting.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      740842c9
    • J
      iotests: add test 226 for file driver types · 2d4cb49d
      John Snow 提交于
      Test that we're rejecting what we ought to for file,
      host_driver and host_cdrom drivers. Test that we're
      seeing the deprecated message for block and chardevs
      on the file driver.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2d4cb49d
    • J
      file-posix: specify expected filetypes · 230ff739
      John Snow 提交于
      Adjust each caller of raw_open_common to specify if they are expecting
      host and character devices or not. Tighten expectations of file types upon
      open in the common code and refuse types that are not expected.
      
      This has two effects:
      
      (1) Character and block devices are now considered deprecated for the
          'file' driver, which expects only S_IFREG, and
      (2) no file-posix driver (file, host_cdrom, or host_device) can open
          directories now.
      
      I don't think there's a legitimate reason to open directories as if
      they were files. This prevents QEMU from opening and attempting to probe
      a directory inode, which can break in exciting ways. One of those ways
      is lseek on ext4/xfs, which will return 0x7fffffffffffffff as the file
      size instead of EISDIR. This can coax QEMU into responding with a
      confusing "file too big" instead of "Hey, that's not a file".
      
      See: https://bugs.launchpad.net/qemu/+bug/1739304/Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      230ff739
    • F
      qemu-img: Document copy offloading implications with -S and -c · eb461485
      Fam Zheng 提交于
      Explicitly enabling zero detection or compression suppresses copy
      offloading during convert. Document it.
      Suggested-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      eb461485
    • F
      iotests: nbd: Stop qemu-nbd before remaking image · 2f9d4083
      Fam Zheng 提交于
      197 is one example where _make_test_img is used twice without stopping
      the NBD server in between. An error will occur like this:
      
          @@ -26,9 +26,13 @@
      
           === Partial final cluster ===
      
          +qemu-img: TEST_DIR/t.IMGFMT: Failed to get "resize" lock
          +Is another process using the image?
           Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
          +Failed to find an available port: Address already in use
           read 1024/1024 bytes at offset 0
      
      Patch _make_test_img to stop the old qemu-nbd before starting a new one,
      which fixes this problem, and similarly 215.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2f9d4083
    • F
      iotests: 153: Fix dead code · 0e1a5827
      Fam Zheng 提交于
      This step was left behind my mistake. As suggested by the echoed text,
      the intention was to test two devices with the same image, with
      different options. The behavior should be the same as two QEMU
      processes. Complete it.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0e1a5827
  3. 12 7月, 2018 8 次提交
  4. 11 7月, 2018 4 次提交
    • P
      error: Remove NULL checks on error_propagate() calls · 78dcf512
      Philippe Mathieu-Daudé 提交于
      Patch created mechanically by rerunning:
      
        $  spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \
                  --macro-file scripts/cocci-macro-file.h \
                  --dir . --in-place
      Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <20180705155811.20366-3-f4bug@amsat.org>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      78dcf512
    • C
      s390x/storage attributes: fix CMMA_BLOCK_SIZE usage · 17f45666
      Claudio Imbrenda 提交于
      The macro CMMA_BLOCK_SIZE was defined but not used, and a hardcoded
      value was instead used in the code.
      
      This patch fixes the value of CMMA_BLOCK_SIZE and uses it in the
      appropriate place in the code, and fixes another case of hardcoded
      value in the KVM backend, replacing it with the more appropriate
      constant KVM_S390_CMMA_SIZE_MAX.
      Signed-off-by: NClaudio Imbrenda <imbrenda@linux.vnet.ibm.com>
      Message-Id: <1530787170-3101-1-git-send-email-imbrenda@linux.vnet.ibm.com>
      Signed-off-by: NCornelia Huck <cohuck@redhat.com>
      17f45666
    • P
      Update version for v3.0.0-rc0 release · c447afd5
      Peter Maydell 提交于
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c447afd5
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 7851f1a7
      Peter Maydell 提交于
      Block layer patches:
      
      - Copy offloading fixes for when the copy increases the image size
      - Temporary revert of the removal of deprecated -drive options
      - Fix request serialisation in the image fleecing scenario
      - Fix copy-on-read crash with unaligned image size
      - Fix another drain crash
      
      # gpg: Signature made Tue 10 Jul 2018 16:37:52 BST
      # gpg:                using RSA key 7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream: (24 commits)
        block: Use common write req handling in truncate
        block: Fix bdrv_co_truncate overlap check
        block: Use common req handling in copy offloading
        block: Use common req handling for discard
        block: Fix handling of image enlarging write
        block: Extract common write req handling
        block: Use uint64_t for BdrvTrackedRequest byte fields
        block: Use BdrvChild to discard
        block: Add copy offloading trace points
        block: Prefix file driver trace points with "file_"
        Revert "block: Remove deprecated -drive geometry options"
        Revert "block: Remove deprecated -drive option addr"
        Revert "block: Remove deprecated -drive option serial"
        Revert "block: Remove dead deprecation warning code"
        block/blklogwrites: Make sure the log sector size is not too small
        qapi/block-core.json: Add missing documentation for blklogwrites log-append option
        block/backup: fix fleecing scheme: use serialized writes
        block: add BDRV_REQ_SERIALISING flag
        block: split flags in copy_range
        block/io: fix copy_range
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      7851f1a7
  5. 10 7月, 2018 17 次提交