提交 611e0653 编写于 作者: W Wang Guang 提交者: Kevin Wolf

replication: Fix replication open fail

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: NWang Guang <wang.guang55@zte.com.cn>
Signed-off-by: NWang Yong <wang.yong155@zte.com.cn>
Reviewed-by: NXie Changlong <xiechanglong@cmss.chinamobile.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 fec035a5
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册