[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/7] file-posix: Update open_flags in raw_set_perm()
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 1/7] file-posix: Update open_flags in raw_set_perm() |
Date: |
Mon, 6 May 2019 21:47:47 +0200 |
raw_check_perm() + raw_set_perm() can change the flags associated with
the current FD. If so, we have to update BDRVRawState.open_flags
accordingly. Otherwise, we may keep reopening the FD even though the
current one already has the correct flags.
Signed-off-by: Max Reitz <address@hidden>
---
block/file-posix.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/file-posix.c b/block/file-posix.c
index 1cf4ee49eb..66b46ec0eb 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -145,6 +145,7 @@ typedef struct BDRVRawState {
uint64_t locked_shared_perm;
int perm_change_fd;
+ int perm_change_flags;
BDRVReopenState *reopen_state;
#ifdef CONFIG_XFS
@@ -2762,6 +2763,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t
perm, uint64_t shared,
return ret;
} else if (ret != s->fd) {
s->perm_change_fd = ret;
+ s->perm_change_flags = open_flags;
}
}
@@ -2800,6 +2802,7 @@ static void raw_set_perm(BlockDriverState *bs, uint64_t
perm, uint64_t shared)
if (s->perm_change_fd && s->fd != s->perm_change_fd) {
qemu_close(s->fd);
s->fd = s->perm_change_fd;
+ s->open_flags = s->perm_change_flags;
}
s->perm_change_fd = 0;
--
2.20.1
- [Qemu-devel] [PATCH 0/7] block: Ignore loosening perm restrictions failures, Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 1/7] file-posix: Update open_flags in raw_set_perm(),
Max Reitz <=
- [Qemu-devel] [PATCH 2/7] block: Add bdrv_child_refresh_perms(), Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 3/7] block/mirror: Fix child permissions, Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 4/7] block/commit: Drop bdrv_child_try_set_perm(), Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 5/7] block: Fix order in bdrv_replace_child(), Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 6/7] block: Add *loosen_restrictions to *check*_perm(), Max Reitz, 2019/05/06
- [Qemu-devel] [PATCH 7/7] block: Ignore loosening perm restrictions failures, Max Reitz, 2019/05/06