From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org, Huawei Xie <huawei.xie@intel.com>,
Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: Dyasly Sergey <s.dyasly@samsung.com>,
Heetae Ahn <heetae82.ahn@samsung.com>,
Vladimir Shilkin <v.shilkin@samsung.com>,
Victor Kaplansky <victork@redhat.com>,
Ilya Maximets <i.maximets@samsung.com>
Subject: [dpdk-dev] [PATCH v2 1/2] vhost: fix leak of file descriptors.
Date: Thu, 16 Jun 2016 12:16:36 +0300 [thread overview]
Message-ID: <1466068597-3449-2-git-send-email-i.maximets@samsung.com> (raw)
In-Reply-To: <1466068597-3449-1-git-send-email-i.maximets@samsung.com>
While migration of vhost-user device QEMU allocates memfd
to store information about dirty pages and sends fd to
vhost-user process.
File descriptor for this memory should be closed to prevent
"Too many open files" error for vhost-user process after
some amount of migrations.
Ex.:
# ls /proc/<ovs-vswitchd pid>/fd/ -alh
total 0
root qemu .
root qemu ..
root qemu 0 -> /dev/pts/0
root qemu 1 -> pipe:[1804353]
root qemu 10 -> socket:[1782240]
root qemu 100 -> /memfd:vhost-log (deleted)
root qemu 1000 -> /memfd:vhost-log (deleted)
root qemu 1001 -> /memfd:vhost-log (deleted)
root qemu 1004 -> /memfd:vhost-log (deleted)
[...]
root qemu 996 -> /memfd:vhost-log (deleted)
root qemu 997 -> /memfd:vhost-log (deleted)
ovs-vswitchd.log:
|WARN|punix:ovs-vswitchd.ctl: accept failed: Too many open files
Fixes: 54f9e32305d4 ("vhost: handle dirty pages logging request")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
lib/librte_vhost/vhost_user/virtio-net-user.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 64a6ec4..e6a2aed 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -401,6 +401,7 @@ user_set_log_base(int vid, struct VhostUserMsg *msg)
* fail when offset is not page size aligned.
*/
addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ close(fd);
if (addr == MAP_FAILED) {
RTE_LOG(ERR, VHOST_CONFIG, "mmap log base failed!\n");
return -1;
--
2.7.4
next prev parent reply other threads:[~2016-06-16 9:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 9:16 [dpdk-dev] [PATCH v2 0/2] vhost: Fix leaks on migration Ilya Maximets
2016-06-16 9:16 ` Ilya Maximets [this message]
2016-06-16 9:16 ` [dpdk-dev] [PATCH v2 2/2] vhost: unmap log memory on cleanup Ilya Maximets
2016-06-20 5:53 ` [dpdk-dev] [PATCH v2 0/2] vhost: Fix leaks on migration Yuanhan Liu
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=1466068597-3449-2-git-send-email-i.maximets@samsung.com \
--to=i.maximets@samsung.com \
--cc=dev@dpdk.org \
--cc=heetae82.ahn@samsung.com \
--cc=huawei.xie@intel.com \
--cc=s.dyasly@samsung.com \
--cc=v.shilkin@samsung.com \
--cc=victork@redhat.com \
--cc=yuanhan.liu@linux.intel.com \
/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).