From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by dpdk.org (Postfix) with ESMTP id A5045C5A0 for ; Thu, 16 Jun 2016 10:32:25 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O8U00CXZVPZPK30@mailout4.w1.samsung.com> for dev@dpdk.org; Thu, 16 Jun 2016 09:32:23 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-2e-576264179aab Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 96.4B.04866.71462675; Thu, 16 Jun 2016 09:32:23 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O8U00EBDVPLKW40@eusync1.samsung.com>; Thu, 16 Jun 2016 09:32:23 +0100 (BST) From: Ilya Maximets To: dev@dpdk.org, Huawei Xie , Yuanhan Liu Cc: Dyasly Sergey , Heetae Ahn , Vladimir Shilkin , Victor Kaplansky , Ilya Maximets Date: Thu, 16 Jun 2016 11:32:04 +0300 Message-id: <1466065925-2736-2-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1466065925-2736-1-git-send-email-i.maximets@samsung.com> References: <1466065925-2736-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t/xy7riKUnhBhuPGli8+7SdyWLa59vs Fu0zzzJZXGn/yW4xebaUxeRNKxgtFh84zGxxfcIFVgcOj18LlrJ6LN7zkslj3slAj/f7rrJ5 9G1ZxRjAGsVlk5Kak1mWWqRvl8CVsXPWD6aClzwVX36cY2lgPMzVxcjJISFgIjFn419WCFtM 4sK99WxdjFwcQgJLGSVmbb0AlhASaGWSWLzVB8RmE9CROLX6CCOILSKQIHFk/29WkAZmgXOM EkuurGECSQgLWErMnzwNrIhFQFXi0bN5YIN4BVwlLlx/yQaxTU7i5rlOZhCbU8BNYsv+71DL XCX+LV/CMoGRdwEjwypG0dTS5ILipPRcI73ixNzi0rx0veT83E2MkPD6uoNx6TGrQ4wCHIxK PLwC6xPDhVgTy4orcw8xSnAwK4nwbkxIChfiTUmsrEotyo8vKs1JLT7EKM3BoiTOO3PX+xAh gfTEktTs1NSC1CKYLBMHp1QDo1Keee7n+MctEoJBKiyle85vadzm6LFM7KKuuGDExyMf51rb yl8I/W73oaQjWk+HvarslyHbHPb5O3hfaUoYnayt8D72/Vp83MZKzcPv5kwLu1+ftV1LKs+f 49Ql9k4u0xVdqpIvfs9u6fz11fndRbOU75dMH/WliLnuUtdvOzJN8B9DkZKVEktxRqKhFnNR cSIAKDzJQysCAAA= Subject: [dpdk-dev] [PATCH 1/2] vhost: fix leak of file descriptors. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2016 08:32:25 -0000 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//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 --- 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 f5248bc..a4e20b5 100644 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c @@ -397,6 +397,7 @@ user_set_log_base(struct vhost_device_ctx ctx, * 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