thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
ddf19c
From f7dd953c2d0380cef3c351afb03d68c6fcda1dca Mon Sep 17 00:00:00 2001
ddf19c
From: Kevin Wolf <kwolf@redhat.com>
ddf19c
Date: Fri, 13 Mar 2020 12:34:28 +0000
ddf19c
Subject: [PATCH 08/20] block: Introduce 'bdrv_reopen_commit_post' step
ddf19c
ddf19c
RH-Author: Kevin Wolf <kwolf@redhat.com>
ddf19c
Message-id: <20200313123439.10548-3-kwolf@redhat.com>
ddf19c
Patchwork-id: 94278
ddf19c
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 02/13] block: Introduce 'bdrv_reopen_commit_post' step
ddf19c
Bugzilla: 1790482 1805143
ddf19c
RH-Acked-by: John Snow <jsnow@redhat.com>
ddf19c
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
ddf19c
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
ddf19c
ddf19c
From: Peter Krempa <pkrempa@redhat.com>
ddf19c
ddf19c
Add another step in the reopen process where driver can execute code
ddf19c
after permission changes are comitted.
ddf19c
ddf19c
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ddf19c
Message-Id: <adc02cf591c3cb34e98e33518eb1c540a0f27db1.1582893284.git.pkrempa@redhat.com>
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
(cherry picked from commit 17e1e2be5f9e84e0298e28e70675655b43e225ea)
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 block.c                   | 9 +++++++++
ddf19c
 include/block/block_int.h | 1 +
ddf19c
 2 files changed, 10 insertions(+)
ddf19c
ddf19c
diff --git a/block.c b/block.c
ddf19c
index e1a4e38..a744bb5 100644
ddf19c
--- a/block.c
ddf19c
+++ b/block.c
ddf19c
@@ -3657,6 +3657,15 @@ cleanup_perm:
ddf19c
             }
ddf19c
         }
ddf19c
     }
ddf19c
+
ddf19c
+    if (ret == 0) {
ddf19c
+        QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) {
ddf19c
+            BlockDriverState *bs = bs_entry->state.bs;
ddf19c
+
ddf19c
+            if (bs->drv->bdrv_reopen_commit_post)
ddf19c
+                bs->drv->bdrv_reopen_commit_post(&bs_entry->state);
ddf19c
+        }
ddf19c
+    }
ddf19c
 cleanup:
ddf19c
     QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
ddf19c
         if (ret) {
ddf19c
diff --git a/include/block/block_int.h b/include/block/block_int.h
ddf19c
index dd033d0..c168690 100644
ddf19c
--- a/include/block/block_int.h
ddf19c
+++ b/include/block/block_int.h
ddf19c
@@ -123,6 +123,7 @@ struct BlockDriver {
ddf19c
     int (*bdrv_reopen_prepare)(BDRVReopenState *reopen_state,
ddf19c
                                BlockReopenQueue *queue, Error **errp);
ddf19c
     void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
ddf19c
+    void (*bdrv_reopen_commit_post)(BDRVReopenState *reopen_state);
ddf19c
     void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
ddf19c
     void (*bdrv_join_options)(QDict *options, QDict *old_options);
ddf19c
 
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c