Blame SOURCES/kvm-curl-Support-auto-read-only-option.patch

7711c0
From a09f5141da57a969a5f7eb89adbf1429680e8ab2 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Fri, 23 Nov 2018 10:41:49 +0100
7711c0
Subject: [PATCH 08/34] curl: Support auto-read-only option
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20181123104154.13541-8-kwolf@redhat.com>
7711c0
Patchwork-id: 83117
7711c0
O-Subject: [RHEL-7.7/7.6.z qemu-kvm-rhev PATCH v2 07/12] curl: Support auto-read-only option
7711c0
Bugzilla: 1623986
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
RH-Acked-by: John Snow <jsnow@redhat.com>
7711c0
7711c0
If read-only=off, but auto-read-only=on is given, just degrade to
7711c0
read-only.
7711c0
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
(cherry picked from commit 6ceef36acb11819b255732b1de0ca62885da04bd)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/curl.c | 8 ++++----
7711c0
 1 file changed, 4 insertions(+), 4 deletions(-)
7711c0
7711c0
diff --git a/block/curl.c b/block/curl.c
7711c0
index aa42535..402f21e 100644
7711c0
--- a/block/curl.c
7711c0
+++ b/block/curl.c
7711c0
@@ -682,10 +682,10 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
7711c0
     const char *protocol_delimiter;
7711c0
     int ret;
7711c0
 
7711c0
-
7711c0
-    if (flags & BDRV_O_RDWR) {
7711c0
-        error_setg(errp, "curl block device does not support writes");
7711c0
-        return -EROFS;
7711c0
+    ret = bdrv_apply_auto_read_only(bs, "curl driver does not support writes",
7711c0
+                                    errp);
7711c0
+    if (ret < 0) {
7711c0
+        return ret;
7711c0
     }
7711c0
 
7711c0
     if (!libcurl_initialized) {
7711c0
-- 
7711c0
1.8.3.1
7711c0