From: Joe Jin <joe.jin@oracle.com>
To: Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [RFC PATCH] block: always update auto_backing_file to full path
Date: Wed, 31 Mar 2021 21:22:14 -0700 [thread overview]
Message-ID: <ce32e1c2-c652-e83b-a6f4-c9773099cf9a@oracle.com> (raw)
Some time after created snapshot, auto_backing_file only has filename,
this confused overridden check, update it to full path if it is not.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
---
block.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/block.c b/block.c
index c5b887cec1..8f9a027dee 100644
--- a/block.c
+++ b/block.c
@@ -6969,6 +6969,19 @@ void bdrv_refresh_filename(BlockDriverState *bs)
return;
}
+ /* auto_backing_file only has filename, update it to the full path */
+ if (bs->backing && bs->auto_backing_file[0] != '/') {
+ char *backing_filename = NULL;
+ Error *local_err = NULL;
+
+ backing_filename = bdrv_make_absolute_filename(bs,
+ bs->auto_backing_file, &local_err);
+ if (!local_err && backing_filename) {
+ pstrcpy(bs->auto_backing_file, sizeof(bs->auto_backing_file),
+ backing_filename);
+ g_free(backing_filename);
+ }
+ }
backing_overridden = bdrv_backing_overridden(bs);
if (bs->open_flags & BDRV_O_NO_IO) {
--
2.21.1 (Apple Git-122.3)
next reply other threads:[~2021-04-01 15:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 4:22 Joe Jin [this message]
2021-04-01 9:57 ` [RFC PATCH] block: always update auto_backing_file to full path Max Reitz
2021-04-01 21:47 ` Joe Jin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce32e1c2-c652-e83b-a6f4-c9773099cf9a@oracle.com \
--to=joe.jin@oracle.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).