From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL for-2.1 1/3] linux-aio: Fix laio resource leak
Date: Tue, 15 Jul 2014 15:55:41 +0200 [thread overview]
Message-ID: <1405432543-9121-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1405432543-9121-1-git-send-email-stefanha@redhat.com>
From: Gonglei <arei.gonglei@huawei.com>
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>
---
block/linux-aio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/linux-aio.c b/block/linux-aio.c
index 4867369..7ac7e8c 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);
}
--
1.9.3
next prev parent reply other threads:[~2014-07-15 13:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 13:55 [Qemu-devel] [PULL for-2.1 0/3] Block patches Stefan Hajnoczi
2014-07-15 13:55 ` Stefan Hajnoczi [this message]
2014-07-15 13:55 ` [Qemu-devel] [PULL for-2.1 2/3] virtio-blk: data-plane: fix save/set .complete_request in start Stefan Hajnoczi
2014-07-15 13:55 ` [Qemu-devel] [PULL for-2.1 3/3] virtio-blk: dataplane: notify guest as a batch Stefan Hajnoczi
2014-07-15 14:50 ` [Qemu-devel] [PULL for-2.1 0/3] Block patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405432543-9121-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).