qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH for-2.1] linux-aio: Fix laio resource leak


From: arei.gonglei
Subject: [Qemu-devel] [PATCH for-2.1] linux-aio: Fix laio resource leak
Date: Sat, 12 Jul 2014 11:23:38 +0800

From: Gonglei <address@hidden>

when hotplug virtio-scsi disks using laio, the aio_nr will
incresment 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 aio_destroy in laio_cleanup().

Reported-by: daifulai <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
 block/linux-aio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index 4867369..af47448 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 0x%p failed\n",
+                        __func__, &s->ctx);
+    }
     g_free(s);
 }
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]