From 1bac8afd02a6b0c9ebccb5d2a6b6070eca0bfa7c Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 7 Apr 2022 17:04:07 +0800 Subject: [PATCH] nvmf/vfio-user: unlink created files Only FDs are used for passing them to another process, we can unlink them after creation. Here we only unlink the files created in vfio-user, and there is still one file created via libvfio-user, it will be fixed via https://github.com/nutanix/libvfio-user/issues/660. Partly fix issue #2449. Change-Id: Ie27640e0cb85f44596e9d0ad5a2b67adf0419f5c Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12195 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: John Levon Reviewed-by: Jim Harris --- lib/nvmf/vfio_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index d33f9425d..972a91a57 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -3347,6 +3347,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport, endpoint_id(endpoint), path, spdk_strerror(errno)); goto out; } + unlink(path); endpoint->devmem_fd = ret; ret = ftruncate(endpoint->devmem_fd, @@ -3379,6 +3380,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport, endpoint_id(endpoint), path, spdk_strerror(errno)); goto out; } + unlink(path); endpoint->migr_fd = ret; ret = ftruncate(endpoint->migr_fd,