提交 03cbdac7 编写于 作者: N Naphtali Sprei 提交者: Anthony Liguori

Disable fall-back to read-only when cannot open drive's file for read-write

Signed-off-by: NNaphtali Sprei <nsprei@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 3f3ed593
...@@ -444,8 +444,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, ...@@ -444,8 +444,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))
bs->enable_write_cache = 1; bs->enable_write_cache = 1;
/* Note: for compatibility, we open disk image files as RDWR, and
RDONLY as fallback */
bs->read_only = (flags & BDRV_O_RDWR) == 0; bs->read_only = (flags & BDRV_O_RDWR) == 0;
if (!(flags & BDRV_O_FILE)) { if (!(flags & BDRV_O_FILE)) {
open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO)); open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO));
...@@ -459,10 +457,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, ...@@ -459,10 +457,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
ret = -ENOTSUP; ret = -ENOTSUP;
} else { } else {
ret = drv->bdrv_open(bs, filename, open_flags); ret = drv->bdrv_open(bs, filename, open_flags);
if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR);
bs->read_only = 1;
}
} }
if (ret < 0) { if (ret < 0) {
qemu_free(bs->opaque); qemu_free(bs->opaque);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册