* [Qemu-devel] [PATCH] replication: Fix replication open fail
@ 2017-10-25 6:51 Wang Guang
2017-10-26 14:52 ` Xie Changlong
2017-10-27 7:15 ` Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Wang Guang @ 2017-10-25 6:51 UTC (permalink / raw)
To: kwolf, wencongyang2, xiechanglong.d, mreitz
Cc: zhang.zhanghailiang, zhangckid, qemu-devel, qemu-block,
Wang Guang, Wang Yong
replication_child_perm request write
permissions for all child which will lead bdrv_check_perm fail.
replication_child_perm() should request write
permissions only if it is writable itself.
Signed-off-by: Wang Guang <wang.guang55@zte.com.cn>
Signed-off-by: Wang Yong <wang.yong155@zte.com.cn>
---
block/replication.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/block/replication.c b/block/replication.c
index 3a4e682..1c95d67 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -161,10 +161,13 @@ static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,
uint64_t perm, uint64_t shared,
uint64_t *nperm, uint64_t *nshared)
{
- *nperm = *nshared = BLK_PERM_CONSISTENT_READ \
- | BLK_PERM_WRITE \
- | BLK_PERM_WRITE_UNCHANGED;
-
+ *nperm = BLK_PERM_CONSISTENT_READ;
+ if ((bs->open_flags & (BDRV_O_INACTIVE | BDRV_O_RDWR)) == BDRV_O_RDWR) {
+ *nperm |= BLK_PERM_WRITE;
+ }
+ *nshared = BLK_PERM_CONSISTENT_READ \
+ | BLK_PERM_WRITE \
+ | BLK_PERM_WRITE_UNCHANGED;
return;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] replication: Fix replication open fail
2017-10-25 6:51 [Qemu-devel] [PATCH] replication: Fix replication open fail Wang Guang
@ 2017-10-26 14:52 ` Xie Changlong
2017-10-27 7:15 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Xie Changlong @ 2017-10-26 14:52 UTC (permalink / raw)
To: Wang Guang, Kevin Wolf, Wen Congyang, Max Reitz
Cc: Zhang Hailiang, zhangckid, qemu-devel, qemu block, Wang Yong
在 10/25/2017 2:51 PM, Wang Guang 写道:
> replication_child_perm request write
> permissions for all child which will lead bdrv_check_perm fail.
> replication_child_perm() should request write
> permissions only if it is writable itself.
>
> Signed-off-by: Wang Guang <wang.guang55@zte.com.cn>
> Signed-off-by: Wang Yong <wang.yong155@zte.com.cn>
Thanks, this patch fixs the problem in
http://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg03358.html.
Reviewed-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
> ---
> block/replication.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/block/replication.c b/block/replication.c
> index 3a4e682..1c95d67 100644
> --- a/block/replication.c
> +++ b/block/replication.c
> @@ -161,10 +161,13 @@ static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,
> uint64_t perm, uint64_t shared,
> uint64_t *nperm, uint64_t *nshared)
> {
> - *nperm = *nshared = BLK_PERM_CONSISTENT_READ \
> - | BLK_PERM_WRITE \
> - | BLK_PERM_WRITE_UNCHANGED;
> -
> + *nperm = BLK_PERM_CONSISTENT_READ;
> + if ((bs->open_flags & (BDRV_O_INACTIVE | BDRV_O_RDWR)) == BDRV_O_RDWR) {
> + *nperm |= BLK_PERM_WRITE;
> + }
> + *nshared = BLK_PERM_CONSISTENT_READ \
> + | BLK_PERM_WRITE \
> + | BLK_PERM_WRITE_UNCHANGED;
> return;
> }
>
>
--
Thanks
-Xie
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] replication: Fix replication open fail
2017-10-25 6:51 [Qemu-devel] [PATCH] replication: Fix replication open fail Wang Guang
2017-10-26 14:52 ` Xie Changlong
@ 2017-10-27 7:15 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2017-10-27 7:15 UTC (permalink / raw)
To: Wang Guang
Cc: wencongyang2, xiechanglong.d, mreitz, zhang.zhanghailiang,
zhangckid, qemu-devel, qemu-block, Wang Yong
Am 25.10.2017 um 08:51 hat Wang Guang geschrieben:
> replication_child_perm request write
> permissions for all child which will lead bdrv_check_perm fail.
> replication_child_perm() should request write
> permissions only if it is writable itself.
>
> Signed-off-by: Wang Guang <wang.guang55@zte.com.cn>
> Signed-off-by: Wang Yong <wang.yong155@zte.com.cn>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-27 7:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-25 6:51 [Qemu-devel] [PATCH] replication: Fix replication open fail Wang Guang
2017-10-26 14:52 ` Xie Changlong
2017-10-27 7:15 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.