diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-03-07 19:07:35 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-03-12 20:30:14 +0100 |
commit | e0c9cf3a484beb746996c0cd63e5585fecb3fd25 (patch) | |
tree | 04272166d4b9afd6f6512b5aa425234c43d842b4 /block/file-posix.c | |
parent | 5cec28702587d8dc9792f8274bfc6bb91f07d672 (diff) |
file-posix: Store BDRVRawState.reopen_state during reopen
We'll want to access the file descriptor in the reopen_state while
processing permission changes in the context of the repoen.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/file-posix.c')
-rw-r--r-- | block/file-posix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/block/file-posix.c b/block/file-posix.c index ae57ba1fc6..6aaee1df16 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -144,6 +144,8 @@ typedef struct BDRVRawState { uint64_t locked_perm; uint64_t locked_shared_perm; + BDRVReopenState *reopen_state; + #ifdef CONFIG_XFS bool is_xfs:1; #endif @@ -952,6 +954,7 @@ static int raw_reopen_prepare(BDRVReopenState *state, } } + s->reopen_state = state; out: qemu_opts_del(opts); return ret; @@ -978,12 +981,16 @@ static void raw_reopen_commit(BDRVReopenState *state) g_free(state->opaque); state->opaque = NULL; + + assert(s->reopen_state == state); + s->reopen_state = NULL; } static void raw_reopen_abort(BDRVReopenState *state) { BDRVRawReopenState *rs = state->opaque; + BDRVRawState *s = state->bs->opaque; /* nothing to do if NULL, we didn't get far enough */ if (rs == NULL) { @@ -996,6 +1003,9 @@ static void raw_reopen_abort(BDRVReopenState *state) } g_free(state->opaque); state->opaque = NULL; + + assert(s->reopen_state == state); + s->reopen_state = NULL; } static int hdev_get_max_transfer_length(BlockDriverState *bs, int fd) |