[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] file-posix: Store BDRVRawState.reopen_state dur
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 5/8] file-posix: Store BDRVRawState.reopen_state during reopen |
Date: |
Fri, 8 Mar 2019 16:37:54 +0100 |
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 <address@hidden>
---
block/file-posix.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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)
--
2.20.1
- [Qemu-devel] [PATCH 0/8] file-posix: Make auto-read-only dynamic, Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 2/8] block: Avoid useless local_err, Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 1/8] tests/virtio-blk-test: Disable auto-read-only, Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 3/8] block: Make permission changes in reopen less wrong, Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 4/8] file-posix: Factor out raw_reconfigure_getfd(), Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 6/8] file-posix: Lock new fd in raw_reopen_prepare(), Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 5/8] file-posix: Store BDRVRawState.reopen_state during reopen,
Kevin Wolf <=
- [Qemu-devel] [PATCH 7/8] file-posix: Prepare permission code for fd switching, Kevin Wolf, 2019/03/08
- [Qemu-devel] [PATCH 8/8] file-posix: Make auto-read-only dynamic, Kevin Wolf, 2019/03/08
- Re: [Qemu-devel] [PATCH 0/8] file-posix: Make auto-read-only dynamic, Peter Krempa, 2019/03/11