diff options
author | Max Reitz <mreitz@redhat.com> | 2017-11-10 21:31:07 +0100 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-11-17 18:21:30 +0100 |
commit | 791fff504cad4d935dfaab6333ff9b7d95cbfe3f (patch) | |
tree | 34b0d8dad955aad47c2a6882bbed8a045feaa1a8 /block/qcow2.c | |
parent | 3e3b838ffeba42eced87595b0a23dc38f7c0c21b (diff) | |
download | qemu-791fff504cad4d935dfaab6333ff9b7d95cbfe3f.zip |
qcow2: check_errors are fatal
When trying to repair a dirty image, qcow2_check() may apparently
succeed (no really fatal error occurred that would prevent the check
from continuing), but if check_errors in the result object is non-zero,
we cannot trust the image to be usable.
Reported-by: R. Nageswara Sastry <nasastry@in.ibm.com>
Buglink: https://bugs.launchpad.net/qemu/+bug/1728639
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20171110203111.7666-2-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 811b913233..1914a940e5 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1477,7 +1477,10 @@ static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS | BDRV_FIX_LEAKS); - if (ret < 0) { + if (ret < 0 || result.check_errors) { + if (ret >= 0) { + ret = -EIO; + } error_setg_errno(errp, -ret, "Could not repair dirty image"); goto fail; } |