[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 20/23] block-backend: Set werror/rerror defaults in b
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 20/23] block-backend: Set werror/rerror defaults in blk_new() |
Date: |
Mon, 1 Oct 2018 19:18:58 +0200 |
Currently, the default values for werror and rerror have to be set
explicitly with blk_set_on_error() by the callers of blk_new(). The only
caller actually doing this is blockdev_init(), which is called for
BlockBackends created using -drive.
In particular, anonymous BlockBackends created with
-device ...,drive=<node-name> didn't get the correct default set and
instead defaulted to the integer value 0 (= BLOCKDEV_ON_ERROR_REPORT).
This is the intended default for rerror anyway, but the default for
werror should be BLOCKDEV_ON_ERROR_ENOSPC.
Set the defaults in blk_new() instead so that they apply no matter what
way the BlockBackend was created.
Cc: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
---
block/block-backend.c | 3 +++
tests/qemu-iotests/067.out | 1 +
2 files changed, 4 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index 7b1ec5071b..dc0cd57724 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -325,6 +325,9 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm)
blk->shared_perm = shared_perm;
blk_set_enable_write_cache(blk, true);
+ blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
+ blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
+
block_acct_init(&blk->stats);
notifier_list_init(&blk->remove_bs_notifiers);
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index 2e71cff3ce..b10c71db03 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -385,6 +385,7 @@ Testing: -device virtio-scsi -device scsi-cd,id=cd0
{
"return": [
{
+ "io-status": "ok",
"device": "",
"locked": false,
"removable": true,
--
2.13.6
- [Qemu-block] [PULL 04/23] block: Remove child references from bs->{options, explicit_options}, (continued)
- [Qemu-block] [PULL 04/23] block: Remove child references from bs->{options, explicit_options}, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 06/23] block: Allow child references on reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 07/23] block: Forbid trying to change unsupported options during reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 05/23] block: Don't look for child references in append_open_options(), Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 10/23] block: Allow changing 'detect-zeroes' on reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 09/23] block: Allow changing 'discard' on reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 19/23] qcow2: Explicit number replaced by a constant, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 12/23] include: Add a lookup table of sizes, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 16/23] qcow2: Increase the default upper limit on the L2 cache size, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 17/23] qcow2: Resize the cache upon image resizing, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 20/23] block-backend: Set werror/rerror defaults in blk_new(),
Kevin Wolf <=
- [Qemu-block] [PULL 21/23] qcow2: Fix cache-clean-interval documentation, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 22/23] test-replication: Lock AioContext around blk_unref(), Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 08/23] file-posix: Forbid trying to change unsupported options during reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 13/23] qcow2: Make sizes more humanly readable, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 18/23] qcow2: Set the default cache-clean-interval to 10 minutes, Kevin Wolf, 2018/10/01