Blame SOURCES/kvm-file-posix-Store-BDRVRawState.reopen_state-during-re.patch

7711c0
From c5a20feec46deb3f25037f29e7ae4823fe46afdf Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Fri, 15 Mar 2019 18:10:07 +0100
7711c0
Subject: [PATCH 011/163] file-posix: Store BDRVRawState.reopen_state during
7711c0
 reopen
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20190315181010.14964-12-kwolf@redhat.com>
7711c0
Patchwork-id: 84888
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 11/14] file-posix: Store BDRVRawState.reopen_state during reopen
7711c0
Bugzilla: 1685989
7711c0
RH-Acked-by: John Snow <jsnow@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
We'll want to access the file descriptor in the reopen_state while
7711c0
processing permission changes in the context of the repoen.
7711c0
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
(cherry picked from commit e0c9cf3a484beb746996c0cd63e5585fecb3fd25)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/file-posix.c | 10 ++++++++++
7711c0
 1 file changed, 10 insertions(+)
7711c0
7711c0
diff --git a/block/file-posix.c b/block/file-posix.c
7711c0
index e50eb0e..b577d88 100644
7711c0
--- a/block/file-posix.c
7711c0
+++ b/block/file-posix.c
7711c0
@@ -156,6 +156,8 @@ typedef struct BDRVRawState {
7711c0
     uint64_t locked_perm;
7711c0
     uint64_t locked_shared_perm;
7711c0
 
7711c0
+    BDRVReopenState *reopen_state;
7711c0
+
7711c0
 #ifdef CONFIG_XFS
7711c0
     bool is_xfs:1;
7711c0
 #endif
7711c0
@@ -926,6 +928,7 @@ static int raw_reopen_prepare(BDRVReopenState *state,
7711c0
         }
7711c0
     }
7711c0
 
7711c0
+    s->reopen_state = state;
7711c0
 out:
7711c0
     return ret;
7711c0
 }
7711c0
@@ -950,12 +953,16 @@ static void raw_reopen_commit(BDRVReopenState *state)
7711c0
 
7711c0
     g_free(state->opaque);
7711c0
     state->opaque = NULL;
7711c0
+
7711c0
+    assert(s->reopen_state == state);
7711c0
+    s->reopen_state = NULL;
7711c0
 }
7711c0
 
7711c0
 
7711c0
 static void raw_reopen_abort(BDRVReopenState *state)
7711c0
 {
7711c0
     BDRVRawReopenState *rs = state->opaque;
7711c0
+    BDRVRawState *s = state->bs->opaque;
7711c0
 
7711c0
      /* nothing to do if NULL, we didn't get far enough */
7711c0
     if (rs == NULL) {
7711c0
@@ -968,6 +975,9 @@ static void raw_reopen_abort(BDRVReopenState *state)
7711c0
     }
7711c0
     g_free(state->opaque);
7711c0
     state->opaque = NULL;
7711c0
+
7711c0
+    assert(s->reopen_state == state);
7711c0
+    s->reopen_state = NULL;
7711c0
 }
7711c0
 
7711c0
 static int hdev_get_max_transfer_length(BlockDriverState *bs, int fd)
7711c0
-- 
7711c0
1.8.3.1
7711c0