[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 51/71] block: Do not copy exact_filename from format
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 51/71] block: Do not copy exact_filename from format file |
Date: |
Mon, 25 Feb 2019 16:20:33 +0100 |
From: Max Reitz <address@hidden>
If a format BDS's file BDS is in turn a format BDS, we cannot simply use
the same filename, because when opening a BDS tree based on a filename
alone, qemu will create only one format node on top of one protocol node
(disregarding a potential backing file).
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 23869623ea..9d9929e1a2 100644
--- a/block.c
+++ b/block.c
@@ -5731,9 +5731,21 @@ void bdrv_refresh_filename(BlockDriverState *bs)
bs->exact_filename[0] = '\0';
- /* If no specific options have been given for this BDS, the filename of
- * the underlying file should suffice for this one as well */
- if (bs->file->bs->exact_filename[0] && !generate_json_filename) {
+ /*
+ * We can use the underlying file's filename if:
+ * - it has a filename,
+ * - the file is a protocol BDS, and
+ * - opening that file (as this BDS's format) will automatically create
+ * the BDS tree we have right now, that is:
+ * - the user did not significantly change this BDS's behavior with
+ * some explicit (strong) options
+ * - no non-file child of this BDS has been overridden by the user
+ * Both of these conditions are represented by
generate_json_filename.
+ */
+ if (bs->file->bs->exact_filename[0] &&
+ bs->file->bs->drv->bdrv_file_open &&
+ !generate_json_filename)
+ {
strcpy(bs->exact_filename, bs->file->bs->exact_filename);
}
}
--
2.20.1
- [Qemu-devel] [PULL 45/71] block: Use bdrv_dirname() for relative filenames, (continued)
- [Qemu-devel] [PULL 45/71] block: Use bdrv_dirname() for relative filenames, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 47/71] block: Add strong_runtime_opts to BlockDriver, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 46/71] iotests: Add quorum case to test 110, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 49/71] block: Generically refresh runtime options, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 48/71] block: Add BlockDriver.bdrv_gather_child_options, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 52/71] block/nvme: Fix bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 53/71] block/curl: Harmonize option defaults, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 54/71] block/curl: Implement bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 55/71] block/null: Generate filename even with latency-ns, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 56/71] block: BDS options may lack the "driver" option, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 51/71] block: Do not copy exact_filename from format file,
Kevin Wolf <=
- [Qemu-devel] [PULL 50/71] block: Purify .bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 58/71] iotests: Re-add filename filters, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 59/71] iotests: Fix 237 for Python 2.x, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 60/71] iotests: Remove superfluous rm from 232, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 57/71] iotests: Test json:{} filenames of internal BDSs, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 61/71] iotests: Fix 232 for LUKS, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 62/71] iotests: Fix 207 to use QMP filters for qmp_log, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 63/71] iotests.py: Add is_str(), Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 65/71] iotests: Filter SSH paths, Kevin Wolf, 2019/02/25
- [Qemu-devel] [PULL 64/71] iotests.py: Filter filename in any string value, Kevin Wolf, 2019/02/25