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 <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12195
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2022-04-07 17:04:07 +08:00 committed by Jim Harris
parent c47b7b0276
commit 1bac8afd02

View File

@ -3347,6 +3347,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
endpoint_id(endpoint), path, spdk_strerror(errno)); endpoint_id(endpoint), path, spdk_strerror(errno));
goto out; goto out;
} }
unlink(path);
endpoint->devmem_fd = ret; endpoint->devmem_fd = ret;
ret = ftruncate(endpoint->devmem_fd, 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)); endpoint_id(endpoint), path, spdk_strerror(errno));
goto out; goto out;
} }
unlink(path);
endpoint->migr_fd = ret; endpoint->migr_fd = ret;
ret = ftruncate(endpoint->migr_fd, ret = ftruncate(endpoint->migr_fd,