[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw
From: |
Dong Jia Shi |
Subject: |
[Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open |
Date: |
Wed, 8 Mar 2017 03:15:33 +0100 |
A normal call for raw_open should always pass in a non-NULL @options,
but for some certain cases (e.g. trying to applying snapshot on a RBD
image), they call raw_open with a NULL @options right after the calling
for raw_close.
Let's take the NULL @options as a sign of trying to do raw_open again,
and just simply return a success code.
Signed-off-by: Dong Jia Shi <address@hidden>
---
block/raw-format.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block/raw-format.c b/block/raw-format.c
index 86fbc65..ee05730 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -384,6 +384,14 @@ static int raw_open(BlockDriverState *bs, QDict *options,
int flags,
BDRVRawState *s = bs->opaque;
int ret;
+ /*
+ * Notice:
+ * NULL options is only sensible when applying a snapshot.
+ */
+ if (!options) {
+ return 0;
+ }
+
bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file,
false, errp);
if (!bs->file) {
--
2.8.4
- [Qemu-block] [PATCH RFC 0/1] block: Handle NULL options correctly in raw_open, Dong Jia Shi, 2017/03/08
- [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open,
Dong Jia Shi <=
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Kevin Wolf, 2017/03/08
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Dong Jia Shi, 2017/03/08
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Dong Jia Shi, 2017/03/12
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Kevin Wolf, 2017/03/13
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Dong Jia Shi, 2017/03/13
- Re: [Qemu-block] [PATCH RFC 1/1] block: Handle NULL options correctly in raw_open, Dong Jia Shi, 2017/03/19