aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2020-05-13 13:05:39 +0200
committerKevin Wolf <kwolf@redhat.com>2020-05-18 19:05:25 +0200
commit69dca43d6b6819b3d0895364692e2d0445674916 (patch)
treed5d337c1400c110d2714bf7012aef655e73db040 /block
parenta16be3cdfce2379b5fb0a17a3017a6c59d73388d (diff)
block: Use bdrv_default_perms()
bdrv_default_perms() can decide which permission profile to use based on the BdrvChildRole, so block drivers do not need to select it explicitly. The blkverify driver now no longer shares the WRITE permission for the image to verify. We thus have to adjust two places in test-block-iothread not to take it. (Note that in theory, blkverify should behave like quorum in this regard and share neither WRITE nor RESIZE for both of its children. In practice, it does not really matter, because blkverify is used only for debugging, so we might as well keep its permissions rather liberal.) Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200513110544.176672-30-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/backup-top.c4
-rw-r--r--block/blkdebug.c4
-rw-r--r--block/blklogwrites.c9
-rw-r--r--block/blkreplay.c2
-rw-r--r--block/blkverify.c2
-rw-r--r--block/bochs.c2
-rw-r--r--block/cloop.c2
-rw-r--r--block/crypto.c2
-rw-r--r--block/dmg.c2
-rw-r--r--block/filter-compress.c2
-rw-r--r--block/parallels.c2
-rw-r--r--block/qcow.c2
-rw-r--r--block/qcow2.c2
-rw-r--r--block/qed.c2
-rw-r--r--block/raw-format.c2
-rw-r--r--block/throttle.c2
-rw-r--r--block/vdi.c2
-rw-r--r--block/vhdx.c2
-rw-r--r--block/vmdk.c2
-rw-r--r--block/vpc.c2
20 files changed, 23 insertions, 28 deletions
diff --git a/block/backup-top.c b/block/backup-top.c
index 8af2c5fe9b..f0efec18b5 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -156,8 +156,8 @@ static void backup_top_child_perm(BlockDriverState *bs, BdrvChild *c,
*nperm = BLK_PERM_WRITE;
} else {
/* Source child */
- bdrv_filter_default_perms(bs, c, child_class, role, reopen_queue,
- perm, shared, nperm, nshared);
+ bdrv_default_perms(bs, c, child_class, role, reopen_queue,
+ perm, shared, nperm, nshared);
if (perm & BLK_PERM_WRITE) {
*nperm = *nperm | BLK_PERM_CONSISTENT_READ;
diff --git a/block/blkdebug.c b/block/blkdebug.c
index b31fa40b0e..a925d8295e 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -1003,8 +1003,8 @@ static void blkdebug_child_perm(BlockDriverState *bs, BdrvChild *c,
{
BDRVBlkdebugState *s = bs->opaque;
- bdrv_filter_default_perms(bs, c, child_class, role, reopen_queue,
- perm, shared, nperm, nshared);
+ bdrv_default_perms(bs, c, child_class, role, reopen_queue,
+ perm, shared, nperm, nshared);
*nperm |= s->take_child_perms;
*nshared &= ~s->unshare_child_perms;
diff --git a/block/blklogwrites.c b/block/blklogwrites.c
index 3a57b273fc..8684fb1c74 100644
--- a/block/blklogwrites.c
+++ b/block/blklogwrites.c
@@ -295,13 +295,8 @@ static void blk_log_writes_child_perm(BlockDriverState *bs, BdrvChild *c,
return;
}
- if (!strcmp(c->name, "log")) {
- bdrv_format_default_perms(bs, c, child_class, role, ro_q, perm, shrd,
- nperm, nshrd);
- } else {
- bdrv_filter_default_perms(bs, c, child_class, role, ro_q, perm, shrd,
- nperm, nshrd);
- }
+ bdrv_default_perms(bs, c, child_class, role, ro_q, perm, shrd,
+ nperm, nshrd);
}
static void blk_log_writes_refresh_limits(BlockDriverState *bs, Error **errp)
diff --git a/block/blkreplay.c b/block/blkreplay.c
index 20d6139baa..30a0f5d57a 100644
--- a/block/blkreplay.c
+++ b/block/blkreplay.c
@@ -139,7 +139,7 @@ static BlockDriver bdrv_blkreplay = {
.is_filter = true,
.bdrv_open = blkreplay_open,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_getlength = blkreplay_getlength,
.bdrv_co_preadv = blkreplay_co_preadv,
diff --git a/block/blkverify.c b/block/blkverify.c
index 5c3b29244a..2f261de24b 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -319,7 +319,7 @@ static BlockDriver bdrv_blkverify = {
.bdrv_parse_filename = blkverify_parse_filename,
.bdrv_file_open = blkverify_open,
.bdrv_close = blkverify_close,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_getlength = blkverify_getlength,
.bdrv_refresh_filename = blkverify_refresh_filename,
.bdrv_dirname = blkverify_dirname,
diff --git a/block/bochs.c b/block/bochs.c
index 62c3f42548..2f010ab40a 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -297,7 +297,7 @@ static BlockDriver bdrv_bochs = {
.instance_size = sizeof(BDRVBochsState),
.bdrv_probe = bochs_probe,
.bdrv_open = bochs_open,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_refresh_limits = bochs_refresh_limits,
.bdrv_co_preadv = bochs_co_preadv,
.bdrv_close = bochs_close,
diff --git a/block/cloop.c b/block/cloop.c
index d374a8427d..c99192a57f 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -293,7 +293,7 @@ static BlockDriver bdrv_cloop = {
.instance_size = sizeof(BDRVCloopState),
.bdrv_probe = cloop_probe,
.bdrv_open = cloop_open,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_refresh_limits = cloop_refresh_limits,
.bdrv_co_preadv = cloop_co_preadv,
.bdrv_close = cloop_close,
diff --git a/block/crypto.c b/block/crypto.c
index 457f3a06a5..b216e12c31 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -756,7 +756,7 @@ static BlockDriver bdrv_crypto_luks = {
.bdrv_close = block_crypto_close,
/* This driver doesn't modify LUKS metadata except when creating image.
* Allow share-rw=on as a special case. */
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create = block_crypto_co_create_luks,
.bdrv_co_create_opts = block_crypto_co_create_opts_luks,
.bdrv_co_truncate = block_crypto_co_truncate,
diff --git a/block/dmg.c b/block/dmg.c
index bc64194577..0d6c317296 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -750,7 +750,7 @@ static BlockDriver bdrv_dmg = {
.bdrv_probe = dmg_probe,
.bdrv_open = dmg_open,
.bdrv_refresh_limits = dmg_refresh_limits,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_preadv = dmg_co_preadv,
.bdrv_close = dmg_close,
.is_format = true,
diff --git a/block/filter-compress.c b/block/filter-compress.c
index 9edd937645..8ec1991c1f 100644
--- a/block/filter-compress.c
+++ b/block/filter-compress.c
@@ -133,7 +133,7 @@ static BlockDriver bdrv_compress = {
.format_name = "compress",
.bdrv_open = compress_open,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_getlength = compress_getlength,
diff --git a/block/parallels.c b/block/parallels.c
index 168d6c531a..63a1cde8af 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -912,7 +912,7 @@ static BlockDriver bdrv_parallels = {
.bdrv_probe = parallels_probe,
.bdrv_open = parallels_open,
.bdrv_close = parallels_close,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_block_status = parallels_co_block_status,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_flush_to_os = parallels_co_flush_to_os,
diff --git a/block/qcow.c b/block/qcow.c
index 5347037720..ee5d35fe20 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -1180,7 +1180,7 @@ static BlockDriver bdrv_qcow = {
.bdrv_probe = qcow_probe,
.bdrv_open = qcow_open,
.bdrv_close = qcow_close,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_reopen_prepare = qcow_reopen_prepare,
.bdrv_co_create = qcow_co_create,
.bdrv_co_create_opts = qcow_co_create_opts,
diff --git a/block/qcow2.c b/block/qcow2.c
index 8d7230dca8..fe0ce39799 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -5744,7 +5744,7 @@ BlockDriver bdrv_qcow2 = {
.bdrv_reopen_commit_post = qcow2_reopen_commit_post,
.bdrv_reopen_abort = qcow2_reopen_abort,
.bdrv_join_options = qcow2_join_options,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create_opts = qcow2_co_create_opts,
.bdrv_co_create = qcow2_co_create,
.bdrv_has_zero_init = qcow2_has_zero_init,
diff --git a/block/qed.c b/block/qed.c
index ef6463b48d..c0c65015c7 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1672,7 +1672,7 @@ static BlockDriver bdrv_qed = {
.bdrv_open = bdrv_qed_open,
.bdrv_close = bdrv_qed_close,
.bdrv_reopen_prepare = bdrv_qed_reopen_prepare,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create = bdrv_qed_co_create,
.bdrv_co_create_opts = bdrv_qed_co_create_opts,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
diff --git a/block/raw-format.c b/block/raw-format.c
index bfb4d7ddb7..018441bddf 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -586,7 +586,7 @@ BlockDriver bdrv_raw = {
.bdrv_reopen_commit = &raw_reopen_commit,
.bdrv_reopen_abort = &raw_reopen_abort,
.bdrv_open = &raw_open,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create_opts = &raw_co_create_opts,
.bdrv_co_preadv = &raw_co_preadv,
.bdrv_co_pwritev = &raw_co_pwritev,
diff --git a/block/throttle.c b/block/throttle.c
index 47b0a3522d..0ebbad0743 100644
--- a/block/throttle.c
+++ b/block/throttle.c
@@ -237,7 +237,7 @@ static BlockDriver bdrv_throttle = {
.bdrv_close = throttle_close,
.bdrv_co_flush = throttle_co_flush,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_getlength = throttle_getlength,
diff --git a/block/vdi.c b/block/vdi.c
index d20698b3cc..2f506a01ba 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -1039,7 +1039,7 @@ static BlockDriver bdrv_vdi = {
.bdrv_open = vdi_open,
.bdrv_close = vdi_close,
.bdrv_reopen_prepare = vdi_reopen_prepare,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create = vdi_co_create,
.bdrv_co_create_opts = vdi_co_create_opts,
.bdrv_has_zero_init = vdi_has_zero_init,
diff --git a/block/vhdx.c b/block/vhdx.c
index 62c6bd69ff..fa9e544a5e 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -2245,7 +2245,7 @@ static BlockDriver bdrv_vhdx = {
.bdrv_open = vhdx_open,
.bdrv_close = vhdx_close,
.bdrv_reopen_prepare = vhdx_reopen_prepare,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_readv = vhdx_co_readv,
.bdrv_co_writev = vhdx_co_writev,
.bdrv_co_create = vhdx_co_create,
diff --git a/block/vmdk.c b/block/vmdk.c
index fadc98a262..62da465126 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -3067,7 +3067,7 @@ static BlockDriver bdrv_vmdk = {
.bdrv_open = vmdk_open,
.bdrv_co_check = vmdk_co_check,
.bdrv_reopen_prepare = vmdk_reopen_prepare,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_preadv = vmdk_co_preadv,
.bdrv_co_pwritev = vmdk_co_pwritev,
.bdrv_co_pwritev_compressed = vmdk_co_pwritev_compressed,
diff --git a/block/vpc.c b/block/vpc.c
index 651a6737b6..c055591641 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -1240,7 +1240,7 @@ static BlockDriver bdrv_vpc = {
.bdrv_open = vpc_open,
.bdrv_close = vpc_close,
.bdrv_reopen_prepare = vpc_reopen_prepare,
- .bdrv_child_perm = bdrv_format_default_perms,
+ .bdrv_child_perm = bdrv_default_perms,
.bdrv_co_create = vpc_co_create,
.bdrv_co_create_opts = vpc_co_create_opts,