Blame SOURCES/kvm-block-backend-Set-werror-rerror-defaults-in-blk_new.patch

7711c0
From db87a7100f44bbaeef9860cf3c313642586bf030 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Tue, 19 Feb 2019 14:35:27 +0100
7711c0
Subject: [PATCH 08/23] block-backend: Set werror/rerror defaults in blk_new()
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20190219143527.26763-2-kwolf@redhat.com>
7711c0
Patchwork-id: 84537
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 1/1] block-backend: Set werror/rerror defaults in blk_new()
7711c0
Bugzilla: 1631615
7711c0
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
7711c0
Currently, the default values for werror and rerror have to be set
7711c0
explicitly with blk_set_on_error() by the callers of blk_new(). The only
7711c0
caller actually doing this is blockdev_init(), which is called for
7711c0
BlockBackends created using -drive.
7711c0
7711c0
In particular, anonymous BlockBackends created with
7711c0
-device ...,drive=<node-name> didn't get the correct default set and
7711c0
instead defaulted to the integer value 0 (= BLOCKDEV_ON_ERROR_REPORT).
7711c0
This is the intended default for rerror anyway, but the default for
7711c0
werror should be BLOCKDEV_ON_ERROR_ENOSPC.
7711c0
7711c0
Set the defaults in blk_new() instead so that they apply no matter what
7711c0
way the BlockBackend was created.
7711c0
7711c0
Cc: qemu-stable@nongnu.org
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
Reviewed-by: Fam Zheng <famz@redhat.com>
7711c0
(cherry picked from commit cb53460b708db3617ab73248374d071d5552c263)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/block-backend.c      | 3 +++
7711c0
 tests/qemu-iotests/067.out | 1 +
7711c0
 2 files changed, 4 insertions(+)
7711c0
7711c0
diff --git a/block/block-backend.c b/block/block-backend.c
7711c0
index 36922d1..ddec869 100644
7711c0
--- a/block/block-backend.c
7711c0
+++ b/block/block-backend.c
7711c0
@@ -325,6 +325,9 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm)
7711c0
     blk->shared_perm = shared_perm;
7711c0
     blk_set_enable_write_cache(blk, true);
7711c0
 
7711c0
+    blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
7711c0
+    blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
7711c0
+
7711c0
     block_acct_init(&blk->stats);
7711c0
 
7711c0
     notifier_list_init(&blk->remove_bs_notifiers);
7711c0
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
7711c0
index 2e71cff..b10c71d 100644
7711c0
--- a/tests/qemu-iotests/067.out
7711c0
+++ b/tests/qemu-iotests/067.out
7711c0
@@ -385,6 +385,7 @@ Testing: -device virtio-scsi -device scsi-cd,id=cd0
7711c0
 {
7711c0
     "return": [
7711c0
         {
7711c0
+            "io-status": "ok",
7711c0
             "device": "",
7711c0
             "locked": false,
7711c0
             "removable": true,
7711c0
-- 
7711c0
1.8.3.1
7711c0