All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 00/41] New op blocker system
@ 2017-02-13 17:22 Kevin Wolf
  2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 01/41] block: Attach bs->file only during .bdrv_open() Kevin Wolf
                   ` (41 more replies)
  0 siblings, 42 replies; 76+ messages in thread
From: Kevin Wolf @ 2017-02-13 17:22 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, jcody, famz, qemu-devel

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(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2017-02-20 14:20 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 17:22 [Qemu-devel] [RFC PATCH 00/41] New op blocker system Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 01/41] block: Attach bs->file only during .bdrv_open() Kevin Wolf
2017-02-15 14:34   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 02/41] block: Add op blocker permission constants Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 03/41] block: Add Error argument to bdrv_attach_child() Kevin Wolf
2017-02-15 14:48   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 04/41] block: Let callers request permissions when attaching a child node Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 05/41] tests: Use opened block node for block job tests Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 06/41] block: Involve block drivers in permission granting Kevin Wolf
2017-02-14  5:51   ` Fam Zheng
2017-02-14 10:36     ` Kevin Wolf
2017-02-14 11:23       ` Fam Zheng
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 07/41] block: Default .bdrv_child_perm() for filter drivers Kevin Wolf
2017-02-15 17:00   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 08/41] block: Request child permissions in " Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 09/41] block: Default .bdrv_child_perm() for format drivers Kevin Wolf
2017-02-14  6:01   ` Fam Zheng
2017-02-14 10:37     ` Kevin Wolf
2017-02-14 11:13       ` Fam Zheng
2017-02-15 17:11   ` Max Reitz
2017-02-15 17:29     ` Kevin Wolf
2017-02-15 17:33       ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 10/41] block: Request child permissions in " Kevin Wolf
2017-02-15 17:26   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 11/41] vvfat: Implement .bdrv_child_perm() Kevin Wolf
2017-02-15 17:30   ` Max Reitz
2017-02-15 17:42     ` Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with child nodes Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 13/41] block: Request real permissions in bdrv_attach_child() Kevin Wolf
2017-02-15 19:23   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 14/41] block: Add permissions to BlockBackend Kevin Wolf
2017-02-15 19:26   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 15/41] block: Add permissions to blk_new() Kevin Wolf
2017-02-20 10:29   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 16/41] block: Add error parameter to blk_insert_bs() Kevin Wolf
2017-02-14  6:58   ` Fam Zheng
2017-02-20 11:04   ` Max Reitz
2017-02-20 11:22     ` Kevin Wolf
2017-02-20 11:22       ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 17/41] block: Request real permissions in blk_new_open() Kevin Wolf
2017-02-20 11:16   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 18/41] block: Allow error return in BlockDevOps.change_media_cb() Kevin Wolf
2017-02-20 11:31   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 19/41] hw/block: Request permissions Kevin Wolf
2017-02-20 12:25   ` Max Reitz
2017-02-20 13:02     ` Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 20/41] hw/block: Introduce share-rw qdev property Kevin Wolf
2017-02-20 12:28   ` Max Reitz
2017-02-20 13:05     ` Kevin Wolf
2017-02-20 13:17       ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 21/41] blockjob: Add permissions to block_job_create() Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 22/41] block: Add BdrvChildRole.get_link_name() Kevin Wolf
2017-02-20 12:54   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 23/41] block: Include details on permission errors in message Kevin Wolf
2017-02-20 13:16   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 24/41] block: Add BdrvChildRole.stay_at_node Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 25/41] blockjob: Add permissions to block_job_add_bdrv() Kevin Wolf
2017-02-20 13:38   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 26/41] block: Factor out bdrv_open_driver() Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 27/41] block: Add bdrv_new_open_driver() Kevin Wolf
2017-02-20 14:20   ` Max Reitz
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 28/41] commit: Use real permissions in commit block job Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 29/41] commit: Use real permissions for HMP 'commit' Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 30/41] backup: Use real permissions in backup block job Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 31/41] block: Fix pending requests check in bdrv_append() Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 32/41] block: BdrvChildRole.attach/detach() callbacks Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 33/41] block: Allow backing file links in change_parent_backing_link() Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 34/41] mirror: Use real permissions in mirror/active commit block job Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 35/41] stream: Use real permissions in streaming " Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 36/41] hmp: Request permissions in qemu-io Kevin Wolf
2017-02-13 17:22 ` [Qemu-devel] [RFC PATCH 37/41] migration/block: Use real permissions Kevin Wolf
2017-02-13 17:23 ` [Qemu-devel] [RFC PATCH 38/41] nbd/server: Use real permissions for NBD exports Kevin Wolf
2017-02-13 17:23 ` [Qemu-devel] [RFC PATCH 39/41] tests: Remove FIXME comments Kevin Wolf
2017-02-13 17:23 ` [Qemu-devel] [RFC PATCH 40/41] block: Pass BdrvChild to bdrv_aligned_preadv/pwritev Kevin Wolf
2017-02-13 17:23 ` [Qemu-devel] [RFC PATCH 41/41] block: Assertions for write permissions Kevin Wolf
2017-02-13 18:44 ` [Qemu-devel] [RFC PATCH 00/41] New op blocker system no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.