thebeanogamer / rpms / qemu-kvm

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