diff options
| author | Gonglei | 2014-07-12 05:43:37 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi | 2014-07-15 15:34:13 +0200 |
| commit | a1abf40d6be2fc4b40d90ae3b46442f4a671776b (patch) | |
| tree | 79e3f7b3c9b0ed4e1d1abeab52a6b4d0f46a3b38 /block/linux-aio.c | |
| parent | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (diff) | |
| download | qemu-a1abf40d6be2fc4b40d90ae3b46442f4a671776b.tar.gz qemu-a1abf40d6be2fc4b40d90ae3b46442f4a671776b.tar.xz qemu-a1abf40d6be2fc4b40d90ae3b46442f4a671776b.zip | |
linux-aio: Fix laio resource leak
when hotplug virtio-scsi disks using laio, the aio_nr will
increase in laio_init() by io_setup(), we can see the number by
# cat /proc/sys/fs/aio-nr
128
if the aio_nr attach the maxnum, which found from
# cat /proc/sys/fs/aio-max-nr
65536
the hotplug process will fail because of aio context leak.
Fix it by io_destroy in laio_cleanup().
Reported-by: daifulai <daifulai@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/linux-aio.c')
| -rw-r--r-- | block/linux-aio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/linux-aio.c b/block/linux-aio.c index 48673690ac..7ac7e8c99c 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -310,5 +310,10 @@ void laio_cleanup(void *s_) struct qemu_laio_state *s = s_; event_notifier_cleanup(&s->e); + + if (io_destroy(s->ctx) != 0) { + fprintf(stderr, "%s: destroy AIO context %p failed\n", + __func__, &s->ctx); + } g_free(s); } |
