[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 079/109] virtiofsd: cleanup allocated resource in se
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PATCH v2 079/109] virtiofsd: cleanup allocated resource in se |
Date: |
Tue, 21 Jan 2020 12:24:03 +0000 |
From: Liu Bo <address@hidden>
This cleans up unfreed resources in se on quiting, including
se->virtio_dev, se->vu_socket_path, se->vu_socketfd.
Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
---
tools/virtiofsd/fuse_lowlevel.c | 7 +++++++
tools/virtiofsd/fuse_virtio.c | 7 +++++++
tools/virtiofsd/fuse_virtio.h | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
index 7dafe02db8..2df120f35c 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -2536,6 +2536,13 @@ void fuse_session_destroy(struct fuse_session *se)
if (se->fd != -1) {
close(se->fd);
}
+
+ if (se->vu_socket_path) {
+ virtio_session_close(se);
+ free(se->vu_socket_path);
+ se->vu_socket_path = NULL;
+ }
+
free(se);
}
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 7a8774a3ee..e7bd772805 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -833,3 +833,10 @@ int virtio_session_mount(struct fuse_session *se)
return 0;
}
+
+void virtio_session_close(struct fuse_session *se)
+{
+ close(se->vu_socketfd);
+ free(se->virtio_dev);
+ se->virtio_dev = NULL;
+}
diff --git a/tools/virtiofsd/fuse_virtio.h b/tools/virtiofsd/fuse_virtio.h
index cc676b9193..111684032c 100644
--- a/tools/virtiofsd/fuse_virtio.h
+++ b/tools/virtiofsd/fuse_virtio.h
@@ -19,7 +19,7 @@
struct fuse_session;
int virtio_session_mount(struct fuse_session *se);
-
+void virtio_session_close(struct fuse_session *se);
int virtio_loop(struct fuse_session *se);
--
2.24.1
- [PATCH v2 071/109] virtiofsd: rename unref_inode() to unref_inode_lolocked(), (continued)
- [PATCH v2 071/109] virtiofsd: rename unref_inode() to unref_inode_lolocked(), Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 072/109] virtiofsd: fail when parent inode isn't known in lo_do_lookup(), Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 070/109] virtiofsd: passthrough_ll: control readdirplus, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 073/109] virtiofsd: extract root inode init into setup_root(), Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 074/109] virtiofsd: passthrough_ll: clean up cache related options, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 075/109] virtiofsd: passthrough_ll: use hashtable, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 076/109] virtiofsd: Clean up inodes on destroy, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 077/109] virtiofsd: support nanosecond resolution for file timestamp, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 078/109] virtiofsd: fix error handling in main(), Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 079/109] virtiofsd: cleanup allocated resource in se,
Dr. David Alan Gilbert (git) <=
- [PATCH v2 080/109] virtiofsd: fix memory leak on lo.source, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 081/109] virtiofsd: add helper for lo_data cleanup, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 082/109] virtiofsd: Prevent multiply running with same vhost_user_socket, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 083/109] virtiofsd: enable PARALLEL_DIROPS during INIT, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 084/109] virtiofsd: fix incorrect error handling in lo_do_lookup, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 085/109] Virtiofsd: fix memory leak on fuse queueinfo, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 086/109] virtiofsd: Support remote posix locks, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 088/109] virtiofsd: prevent fv_queue_thread() vs virtio_loop() races, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 087/109] virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy(), Dr. David Alan Gilbert (git), 2020/01/21