cryptospore / rpms / qemu-kvm

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