[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 6/9] virtio-blk: pause I/O hang when resetting
From: |
Jiahui Cen |
Subject: |
[PATCH v3 6/9] virtio-blk: pause I/O hang when resetting |
Date: |
Thu, 22 Oct 2020 21:03:00 +0800 |
When resetting virtio-blk, we have to drain all AIOs but do not care about the
results. So it is necessary to disable I/O hang before resetting virtio-blk,
and enable it after resetting.
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
hw/block/virtio-blk.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index bac2d6fa2b..f96e4ac274 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -899,6 +899,10 @@ static void virtio_blk_reset(VirtIODevice *vdev)
AioContext *ctx;
VirtIOBlockReq *req;
+ if (blk_iohang_is_enabled(s->blk)) {
+ blk_rehandle_pause(s->blk);
+ }
+
ctx = blk_get_aio_context(s->blk);
aio_context_acquire(ctx);
blk_drain(s->blk);
@@ -916,6 +920,10 @@ static void virtio_blk_reset(VirtIODevice *vdev)
assert(!s->dataplane_started);
blk_set_enable_write_cache(s->blk, s->original_wce);
+
+ if (blk_iohang_is_enabled(s->blk)) {
+ blk_rehandle_unpause(s->blk);
+ }
}
/* coalesce internal state, copy to pci i/o region 0
--
2.19.1
- [PATCH v3 0/9] block-backend: Introduce I/O hang, Jiahui Cen, 2020/10/22
- [PATCH v3 3/9] block-backend: add I/O hang timeout, Jiahui Cen, 2020/10/22
- [PATCH v3 1/9] block-backend: introduce I/O rehandle info, Jiahui Cen, 2020/10/22
- [PATCH v3 5/9] block-backend: enable I/O hang when timeout is set, Jiahui Cen, 2020/10/22
- [PATCH v3 4/9] block-backend: add I/O rehandle pause/unpause, Jiahui Cen, 2020/10/22
- [PATCH v3 7/9] qemu-option: add I/O hang timeout option, Jiahui Cen, 2020/10/22
- [PATCH v3 8/9] qapi: add I/O hang and I/O hang timeout qapi event, Jiahui Cen, 2020/10/22
- [PATCH v3 2/9] block-backend: rehandle block aios when EIO, Jiahui Cen, 2020/10/22
- [PATCH v3 6/9] virtio-blk: pause I/O hang when resetting,
Jiahui Cen <=
- [PATCH v3 9/9] docs: add a doc about I/O hang, Jiahui Cen, 2020/10/22
- Re: [PATCH v3 0/9] block-backend: Introduce I/O hang, Stefan Hajnoczi, 2020/10/26