提交 a1abf40d 编写于 作者: G Gonglei 提交者: Stefan Hajnoczi

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: Ndaifulai <daifulai@huawei.com>
Signed-off-by: NGonglei <arei.gonglei@huawei.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 7a6d04e7
...@@ -310,5 +310,10 @@ void laio_cleanup(void *s_) ...@@ -310,5 +310,10 @@ void laio_cleanup(void *s_)
struct qemu_laio_state *s = s_; struct qemu_laio_state *s = s_;
event_notifier_cleanup(&s->e); 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); g_free(s);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册