Skip to content

RFC New op blocker system

Kevin Wolf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest41 patches 33 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/41block: Attach bs->file only during .bdrv_open()block.c block/bochs.c block/cloop.c +14 more+129 -211 reply
2/41block: Add op blocker permission constantsinclude/block/block_int.h+34 -00 replies
3/41block: Add Error argument to bdrv_attach_child()block.c block/quorum.c include/block/block.h+19 -51 reply
4/41block: Let callers request permissions when attaching a child nodeblock.c block/block-backend.c include/block/block_int.h+78 -110 replies
5/41tests: Use opened block node for block job teststests/test-blockjob-txn.c tests/test-blockjob.c+10 -20 replies
6/41block: Involve block drivers in permission grantingblock.c include/block/block_int.h+171 -03 replies
7/41block: Default .bdrv_child_perm() for filter driversblock.c include/block/block_int.h+32 -01 reply
8/41block: Request child permissions in filter driversblock/blkdebug.c block/blkreplay.c block/blkverify.c +3 more+8 -00 replies
9/41block: Default .bdrv_child_perm() for format driversblock.c include/block/block_int.h+45 -06 replies
10/41block: Request child permissions in format driversblock/bochs.c block/cloop.c block/crypto.c +9 more+12 -01 reply
11/41vvfat: Implement .bdrv_child_perm()block/vvfat.c+13 -02 replies
12/41block: Require .bdrv_child_perm() with child nodesblock.c+4 -20 replies
13/41block: Request real permissions in bdrv_attach_child()block.c+15 -21 reply
14/41block: Add permissions to BlockBackendblock/block-backend.c include/sysemu/block-backend.h+29 -01 reply
15/41block: Add permissions to blk_new()block/backup.c block/block-backend.c block/commit.c +13 more+42 -261 reply
16/41block: Add error parameter to blk_insert_bs()block/backup.c block/block-backend.c block/commit.c +9 more+84 -244 replies
17/41block: Request real permissions in blk_new_open()block/block-backend.c+14 -21 reply
18/41block: Allow error return in BlockDevOps.change_media_cb()block/block-backend.c blockdev.c hw/block/fdc.c +5 more+30 -131 reply
19/41hw/block: Request permissionshw/block/block.c hw/block/fdc.c hw/block/m25p80.c +14 more+137 -272 replies
20/41hw/block: Introduce share-rw qdev propertyhw/block/block.c include/hw/block/block.h tests/qemu-iotests/172.out+64 -73 replies
21/41blockjob: Add permissions to block_job_create()block/backup.c block/commit.c block/mirror.c +5 more+24 -170 replies
22/41block: Add BdrvChildRole.get_link_name()block.c block/block-backend.c include/block/block_int.h+32 -01 reply
23/41block: Include details on permission errors in messageblock.c+55 -111 reply
24/41block: Add BdrvChildRole.stay_at_nodeblock.c include/block/block_int.h+7 -00 replies
25/41blockjob: Add permissions to block_job_add_bdrv()block/backup.c block/commit.c block/mirror.c +3 more+38 -131 reply
26/41block: Factor out bdrv_open_driver()block.c+65 -470 replies
27/41block: Add bdrv_new_open_driver()block.c include/block/block.h+32 -11 reply
28/41commit: Use real permissions in commit block jobblock/commit.c+89 -160 replies
29/41commit: Use real permissions for HMP 'commit'block/commit.c+26 -50 replies
30/41backup: Use real permissions in backup block jobblock/backup.c tests/qemu-iotests/055+17 -90 replies
31/41block: Fix pending requests check in bdrv_append()block.c+2 -20 replies
32/41block: BdrvChildRole.attach/detach() callbacksblock.c include/block/block_int.h+62 -350 replies
33/41block: Allow backing file links in change_parent_backing_link()block.c+3 -40 replies
34/41mirror: Use real permissions in mirror/active commit block jobblock/mirror.c qemu-img.c tests/qemu-iotests/141 +1 more+143 -290 replies
35/41stream: Use real permissions in streaming block jobblock/stream.c+26 -120 replies
36/41hmp: Request permissions in qemu-ioblock/block-backend.c hmp.c include/qemu-io.h +2 more+61 -10 replies
37/41migration/block: Use real permissionsmigration/block.c+16 -50 replies
38/41nbd/server: Use real permissions for NBD exportsnbd/server.c+9 -20 replies
39/41tests: Remove FIXME commentstests/test-blockjob.c tests/test-throttle.c+2 -20 replies
40/41block: Pass BdrvChild to bdrv_aligned_preadv/pwritevblock/io.c+17 -140 replies
41/41block: Assertions for write permissionsblock/io.c+7 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC PATCH 00/41] New op blocker system

This series is a first rough attempt at implementing the new op blocker system whose design was agreed on quite a while ago, but proved a bit tricky to implement in places. There is still work left to do, but if we want to get this (or the greatest part of it) into 2.9, it's probably time to start review and discussion.

The basic idea is that every user of a block node (including things outside the block layer that go through a BlockBackend, and also other block nodes that hold references to it) has to declare which low-level operations/permissions it needs and which operation it allows other users to perform on the same node. Depending on these declarations, conflicts are avoided by returning an error for attempts to attach a conflicting user to the same node.

After this series, all users request permissions, and hopefully all of the permissions they need. For a subset of them, getting the permission first is actually enforced with assertions. We can probably add more assertions to this.

The series doesn't remove the old op blockers yet, though in theory the new op blockers should block everything they used to block. (In practice it's not completely true yet, some monitor commands don't get the right permissions yet, in particular related to resize/graph modification.)

Kevin Wolf (41):
block: Attach bs->file only during .bdrv_open()
block: Add op blocker permission constants
block: Add Error argument to bdrv_attach_child()
block: Let callers request permissions when attaching a child node
tests: Use opened block node for block job tests
block: Involve block drivers in permission granting
block: Default .bdrv_child_perm() for filter drivers
block: Request child permissions in filter drivers
block: Default .bdrv_child_perm() for format drivers
block: Request child permissions in format drivers
vvfat: Implement .bdrv_child_perm()
block: Require .bdrv_child_perm() with child nodes
block: Request real permissions in bdrv_attach_child()
block: Add permissions to BlockBackend
block: Add permissions to blk_new()
block: Add error parameter to blk_insert_bs()
block: Request real permissions in blk_new_open()
block: Allow error return in BlockDevOps.change_media_cb() hw/block: Request permissions
hw/block: Introduce share-rw qdev property
blockjob: Add permissions to block_job_create()
block: Add BdrvChildRole.get_link_name()
block: Include details on permission errors in message
block: Add BdrvChildRole.stay_at_node
blockjob: Add permissions to block_job_add_bdrv()
block: Factor out bdrv_open_driver()
block: Add bdrv_new_open_driver()
commit: Use real permissions in commit block job
commit: Use real permissions for HMP 'commit'
backup: Use real permissions in backup block job
block: Fix pending requests check in bdrv_append()
block: BdrvChildRole.attach/detach() callbacks
block: Allow backing file links in change_parent_backing_link()
mirror: Use real permissions in mirror/active commit block job
stream: Use real permissions in streaming block job
hmp: Request permissions in qemu-io
migration/block: Use real permissions
nbd/server: Use real permissions for NBD exports
tests: Remove FIXME comments
block: Pass BdrvChild to bdrv_aligned_preadv/pwritev
block: Assertions for write permissions

 block.c                          | 615 ++++++++++++++++++++++++++++++++-------
 block/backup.c                   |  21 +-
 block/blkdebug.c                 |   2 +
 block/blkreplay.c                |   1 +
 block/blkverify.c                |   1 +
 block/block-backend.c            |  95 +++++-
 block/bochs.c                    |   7 +
 block/cloop.c                    |   7 +
 block/commit.c                   | 164 +++++++++--
 block/crypto.c                   |   7 +
 block/dmg.c                      |   7 +
 block/io.c                       |  40 ++-
 block/mirror.c                   | 160 ++++++++--
 block/parallels.c                |   7 +
 block/qcow.c                     |   7 +
 block/qcow2.c                    |  19 +-
 block/qed.c                      |  19 +-
 block/quorum.c                   |  10 +-
 block/raw-format.c               |   7 +
 block/replication.c              |   7 +
 block/stream.c                   |  36 ++-
 block/vdi.c                      |   7 +
 block/vhdx.c                     |   7 +
 block/vmdk.c                     |   7 +
 block/vpc.c                      |   7 +
 block/vvfat.c                    |  13 +
 blockdev.c                       |  27 +-
 blockjob.c                       |  39 ++-
 hmp.c                            |  33 ++-
 hw/block/block.c                 |  21 +-
 hw/block/fdc.c                   |  28 +-
 hw/block/m25p80.c                |   8 +
 hw/block/nand.c                  |   7 +
 hw/block/nvme.c                  |   8 +-
 hw/block/onenand.c               |   7 +
 hw/block/pflash_cfi01.c          |  18 +-
 hw/block/pflash_cfi02.c          |  19 +-
 hw/block/virtio-blk.c            |   8 +-
 hw/core/qdev-properties-system.c |   9 +-
 hw/ide/core.c                    |   2 +-
 hw/ide/qdev.c                    |   8 +-
 hw/nvram/spapr_nvram.c           |   8 +
 hw/scsi/scsi-disk.c              |  11 +-
 hw/sd/sd.c                       |   8 +-
 hw/usb/dev-storage.c             |   6 +-
 include/block/block.h            |   5 +-
 include/block/block_int.h        | 124 +++++++-
 include/block/blockjob.h         |   4 +-
 include/block/blockjob_int.h     |   4 +-
 include/hw/block/block.h         |   7 +-
 include/qemu-io.h                |   1 +
 include/sysemu/block-backend.h   |   9 +-
 migration/block.c                |  20 +-
 nbd/server.c                     |  16 +-
 qemu-img.c                       |   6 +-
 qemu-io-cmds.c                   |  28 ++
 tests/qemu-iotests/051.out       |   4 +-
 tests/qemu-iotests/051.pc.out    |  10 +-
 tests/qemu-iotests/055           |  11 +-
 tests/qemu-iotests/141           |   2 +-
 tests/qemu-iotests/141.out       |   4 +-
 tests/qemu-iotests/172.out       |  53 ++++
 tests/test-blockjob-txn.c        |  12 +-
 tests/test-blockjob.c            |  16 +-
 tests/test-throttle.c            |   7 +-
 65 files changed, 1616 insertions(+), 282 deletions(-)
Signature · 1 line
1.8.3.1