|
|
a83cc2 |
From 872e82621b1341e8b96bda47f7f43dfffd356249 Mon Sep 17 00:00:00 2001
|
|
|
a83cc2 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Date: Tue, 27 Jul 2021 17:49:23 +0200
|
|
|
a83cc2 |
Subject: [PATCH 04/13] block: Fix in_flight leak in request padding error path
|
|
|
a83cc2 |
|
|
|
a83cc2 |
RH-Author: Kevin Wolf <None>
|
|
|
a83cc2 |
RH-MergeRequest: 31: block: Fix in_flight leak in request padding error path
|
|
|
a83cc2 |
RH-Commit: [1/1] a0d1bf38d9a69818cd6cefc3779f2988b484605a (kmwolf/centos-qemu-kvm)
|
|
|
a83cc2 |
RH-Bugzilla: 1972079
|
|
|
a83cc2 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
When bdrv_pad_request() fails in bdrv_co_preadv_part(), bs->in_flight
|
|
|
a83cc2 |
has been increased, but is never decreased again. This leads to a hang
|
|
|
a83cc2 |
when trying to drain the block node.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
This bug was observed with Windows guests which issue a request that
|
|
|
a83cc2 |
fully uses IOV_MAX during installation, so that when padding is
|
|
|
a83cc2 |
necessary (O_DIRECT with a 4k sector size block device on the host),
|
|
|
a83cc2 |
adding another entry causes failure.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Call bdrv_dec_in_flight() to fix this. There is a larger problem to
|
|
|
a83cc2 |
solve here because this request shouldn't even fail, but Windows doesn't
|
|
|
a83cc2 |
seem to care and with this minimal fix the installation succeeds. So
|
|
|
a83cc2 |
given that we're already in freeze, let's take this minimal fix for 6.1.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Fixes: 98ca45494fcd6bf0336ecd559e440b6de6ea4cd3
|
|
|
a83cc2 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1972079
|
|
|
a83cc2 |
Reported-by: Qing Wang <qinwang@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Message-Id: <20210727154923.91067-1-kwolf@redhat.com>
|
|
|
a83cc2 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
(cherry picked from commit 87ab88025247b893aad5071fd38301b67be76d1a)
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
---
|
|
|
a83cc2 |
block/io.c | 7 ++++---
|
|
|
a83cc2 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/block/io.c b/block/io.c
|
|
|
a83cc2 |
index a4b2e3adf1..5033d51334 100644
|
|
|
a83cc2 |
--- a/block/io.c
|
|
|
a83cc2 |
+++ b/block/io.c
|
|
|
a83cc2 |
@@ -1811,7 +1811,7 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child,
|
|
|
a83cc2 |
ret = bdrv_pad_request(bs, &qiov, &qiov_offset, &offset, &bytes, &pad,
|
|
|
a83cc2 |
NULL);
|
|
|
a83cc2 |
if (ret < 0) {
|
|
|
a83cc2 |
- return ret;
|
|
|
a83cc2 |
+ goto fail;
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ);
|
|
|
a83cc2 |
@@ -1819,10 +1819,11 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child,
|
|
|
a83cc2 |
bs->bl.request_alignment,
|
|
|
a83cc2 |
qiov, qiov_offset, flags);
|
|
|
a83cc2 |
tracked_request_end(&req;;
|
|
|
a83cc2 |
- bdrv_dec_in_flight(bs);
|
|
|
a83cc2 |
-
|
|
|
a83cc2 |
bdrv_padding_destroy(&pad;;
|
|
|
a83cc2 |
|
|
|
a83cc2 |
+fail:
|
|
|
a83cc2 |
+ bdrv_dec_in_flight(bs);
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
return ret;
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
--
|
|
|
a83cc2 |
2.27.0
|
|
|
a83cc2 |
|