[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup_bs() |
Date: |
Tue, 27 Jan 2015 14:45:50 -0500 |
blk_by_name() may return a BlockBackend for which blk_bs() returns NULL.
In this case, an error should be returned (instead of just returning
NULL without modifying *errp).
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block.c b/block.c
index 9a0a510..b7e631c 100644
--- a/block.c
+++ b/block.c
@@ -3718,6 +3718,11 @@ BlockDriverState *bdrv_lookup_bs(const char *device,
blk = blk_by_name(device);
if (blk) {
+ if (!blk_bs(blk)) {
+ error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
+ return NULL;
+ }
+
return blk_bs(blk);
}
}
--
2.1.0
- Re: [Qemu-devel] [PATCH RESEND 49/50] iotests: More options for VM.add_drive(), (continued)
[Qemu-devel] [PATCH RESEND 50/50] iotests: Add test for change-related QMP commands, Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 48/50] hmp: Add read-only option to change command, Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 03/50] hw/block/fdc: Implement tray status, Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup_bs(),
Max Reitz <=
[Qemu-devel] [PATCH RESEND 37/50] block: Add blk_remove_bs(), Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 20/50] blockdev: Check blk_is_available() in sn-del-int-sync, Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 14/50] block: Make some BB functions fall back to BBRS, Max Reitz, 2015/01/27
[Qemu-devel] [PATCH RESEND 01/50] blockdev: Allow creation of BDS trees without BB, Max Reitz, 2015/01/27