Commit eeae6a59 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
parent 04f600ef
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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;
}