mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
block: Update flags in bdrv_set_read_only()
To fully change the read-only state of a node, we must not only change bs->read_only, but also update bs->open_flags. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com>
This commit is contained in:
parent
04f600ef7c
commit
eeae6a596b
1 changed files with 7 additions and 0 deletions
7
block.c
7
block.c
|
@ -281,6 +281,13 @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
|
|||
}
|
||||
|
||||
bs->read_only = read_only;
|
||||
|
||||
if (read_only) {
|
||||
bs->open_flags &= ~BDRV_O_RDWR;
|
||||
} else {
|
||||
bs->open_flags |= BDRV_O_RDWR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue