yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

26ba25
From d0bc458b5072ac0e7ee4d27431d5f614f8dd4328 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 6 Dec 2018 17:12:39 +0000
26ba25
Subject: [PATCH 14/15] block-backend: Set werror/rerror defaults in blk_new()
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20181206171240.5674-15-kwolf@redhat.com>
26ba25
Patchwork-id: 83291
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 14/15] block-backend: Set werror/rerror defaults in blk_new()
26ba25
Bugzilla: 1657637
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: John Snow <jsnow@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
26ba25
Currently, the default values for werror and rerror have to be set
26ba25
explicitly with blk_set_on_error() by the callers of blk_new(). The only
26ba25
caller actually doing this is blockdev_init(), which is called for
26ba25
BlockBackends created using -drive.
26ba25
26ba25
In particular, anonymous BlockBackends created with
26ba25
-device ...,drive=<node-name> didn't get the correct default set and
26ba25
instead defaulted to the integer value 0 (= BLOCKDEV_ON_ERROR_REPORT).
26ba25
This is the intended default for rerror anyway, but the default for
26ba25
werror should be BLOCKDEV_ON_ERROR_ENOSPC.
26ba25
26ba25
Set the defaults in blk_new() instead so that they apply no matter what
26ba25
way the BlockBackend was created.
26ba25
26ba25
Cc: qemu-stable@nongnu.org
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Reviewed-by: Fam Zheng <famz@redhat.com>
26ba25
(cherry picked from commit cb53460b708db3617ab73248374d071d5552c263)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/block-backend.c      | 3 +++
26ba25
 tests/qemu-iotests/067.out | 1 +
26ba25
 2 files changed, 4 insertions(+)
26ba25
26ba25
diff --git a/block/block-backend.c b/block/block-backend.c
26ba25
index 91abfe6..7ae5832 100644
26ba25
--- a/block/block-backend.c
26ba25
+++ b/block/block-backend.c
26ba25
@@ -325,6 +325,9 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm)
26ba25
     blk->shared_perm = shared_perm;
26ba25
     blk_set_enable_write_cache(blk, true);
26ba25
 
26ba25
+    blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
26ba25
+    blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
26ba25
+
26ba25
     block_acct_init(&blk->stats);
26ba25
 
26ba25
     notifier_list_init(&blk->remove_bs_notifiers);
26ba25
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
26ba25
index 2e71cff..b10c71d 100644
26ba25
--- a/tests/qemu-iotests/067.out
26ba25
+++ b/tests/qemu-iotests/067.out
26ba25
@@ -385,6 +385,7 @@ Testing: -device virtio-scsi -device scsi-cd,id=cd0
26ba25
 {
26ba25
     "return": [
26ba25
         {
26ba25
+            "io-status": "ok",
26ba25
             "device": "",
26ba25
             "locked": false,
26ba25
             "removable": true,
26ba25
-- 
26ba25
1.8.3.1
26ba25