Received: from eggs.gnu.org ([2001:4830:134:3::10]:43182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpwdy-0006ME-VD for qemu-devel@nongnu.org; Fri, 30 Sep 2016 08:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpwdx-00062m-JS for qemu-devel@nongnu.org; Fri, 30 Sep 2016 08:10:22 -0400 From: Fam Zheng Date: Fri, 30 Sep 2016 20:09:30 +0800 Message-Id: <1475237406-26917-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v8 00/36] block: Image locking series List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: berrange@redhat.com, John Snow , qemu-block@nongnu.org, Kevin Wolf , rjones@redhat.com, Jeff Cody , Max Reitz , Markus Armbruster , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com, eblake@redhat.com Hi all, I wanted to post something before the long holiday as promised, but I couldn't refine or test enough due to limited time. Please take this as an RFC and do a high level review. Thanks. v8: Move user interface option from block device to qdev. [Kevin] Add "exclusive" back. [Kevin] Note: limited by the qdev interface, until blk_lock_image() is called, the images are not locked by block layer at open, because before device tells us what to do, block layer cannot figure out the correct lock mode any more. TODO 1: Lock explicitly in utils (qemu-img, qemu-io, etc) after opening image. TODO 2: The image locking test case 153 patch is not updated thus broken because of the moved option. TODO 3: Are the open flags unnecessary because we already have ImageLockMode? If so, how to converge them? Fam Zheng (36): block: Add flag bits for image locking qapi: Add ImageLockMode block: Introduce image file locking osdep: Add qemu_lock_fd and qemu_unlock_fd raw-posix: Add image locking support qemu-io: Add "-L" option for BDRV_O_NO_LOCK qemu-img: Add "-L" option to sub commands qemu-img: Update documentation of "-L" option qemu-nbd: Add "--no-lock/-L" option block: Don't lock drive-backup target image in none mode block: Add blk_lock_image virtio-blk: Apply lock-mode when realize scsi-disk: Apply lock-mode when realize scsi-generic: Apply lock-mode when realize qdev: Add "lock-mode" to block device options ide: Apply lock-mode when initialize nvme: Apply lock-mode when initialize usb-storage: Apply lock-mode when realize pflash: Add "lock-mode" property qemu-iotests: 046: Move version detection out from verify_io qemu-iotests: 091: Prepare for image lock qemu-iotests: 030: Disable image locking when checking test image iotests: 087: Disable image locking in cases where file is shared iotests: 087: Disable image locking in cases where file is shared iotests: 130: Check image info locklessly iotests: Disable image locking in 085 tests: Use null-co:// instead of /dev/null qemu-iotests: Add test case 153 for image locking ahci: Use shared lock for shared storage migration tests/postcopy: Use shared lock for images fdc: Add lock-mode qdev properties m25p80: Add 'lock-mode' property nand: Add 'lock-mode' property onenand: Add 'lock-mode' property spapr_nvram: Add 'lock-mode' property sd: Add 'lock-mode' property block.c | 52 +++++ block/block-backend.c | 18 ++ block/raw-posix.c | 318 +++++++++++++++++++++++++++++- blockdev.c | 5 + hw/block/fdc.c | 19 +- hw/block/m25p80.c | 8 + hw/block/nand.c | 8 + hw/block/nvme.c | 6 +- hw/block/onenand.c | 7 + hw/block/pflash_cfi01.c | 10 + hw/block/pflash_cfi02.c | 9 + hw/block/virtio-blk.c | 5 + hw/core/qdev-properties.c | 10 + hw/ide/core.c | 10 +- hw/ide/qdev.c | 2 +- hw/nvram/spapr_nvram.c | 8 + hw/scsi/scsi-disk.c | 6 + hw/scsi/scsi-generic.c | 7 + hw/sd/sd.c | 8 + hw/usb/dev-storage.c | 5 + include/block/block.h | 8 +- include/block/block_int.h | 5 + include/hw/block/block.h | 3 + include/hw/ide/internal.h | 3 +- include/hw/qdev-properties.h | 3 + include/qemu/osdep.h | 2 + include/sysemu/block-backend.h | 2 + qapi/block-core.json | 18 ++ qemu-img-cmds.hx | 44 ++--- qemu-img.c | 92 +++++++-- qemu-img.texi | 3 + qemu-io.c | 24 ++- qemu-nbd.c | 7 +- qemu-nbd.texi | 2 + tests/ahci-test.c | 27 ++- tests/drive_del-test.c | 2 +- tests/nvme-test.c | 2 +- tests/postcopy-test.c | 9 +- tests/qemu-iotests/030 | 2 +- tests/qemu-iotests/046 | 22 ++- tests/qemu-iotests/085 | 6 +- tests/qemu-iotests/091 | 9 +- tests/qemu-iotests/091.out | 1 + tests/qemu-iotests/130 | 4 +- tests/qemu-iotests/130.out | 4 +- tests/qemu-iotests/153 | 197 +++++++++++++++++++ tests/qemu-iotests/153.out | 426 +++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-scsi-test.c | 4 +- util/osdep.c | 29 +++ 53 files changed, 1398 insertions(+), 90 deletions(-) create mode 100755 tests/qemu-iotests/153 create mode 100644 tests/qemu-iotests/153.out -- 2.7.4