|
|
ddf19c |
From 7a3c94e10b087c06635ef72aadb1550184dd5c58 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ddf19c |
Date: Mon, 27 Jan 2020 19:01:58 +0100
|
|
|
ddf19c |
Subject: [PATCH 087/116] virtiofsd: add helper for lo_data cleanup
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
Message-id: <20200127190227.40942-84-dgilbert@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93538
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 083/112] virtiofsd: add helper for lo_data cleanup
|
|
|
ddf19c |
Bugzilla: 1694164
|
|
|
ddf19c |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
From: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
This offers an helper function for lo_data's cleanup.
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
ddf19c |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 18a69cbbb6a4caa7c2040c6db4a33b044a32be7e)
|
|
|
ddf19c |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
tools/virtiofsd/passthrough_ll.c | 37 +++++++++++++++++++++----------------
|
|
|
ddf19c |
1 file changed, 21 insertions(+), 16 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
index 056ebe8..e8dc5c7 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
+++ b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
@@ -2407,6 +2407,26 @@ static gboolean lo_key_equal(gconstpointer a, gconstpointer b)
|
|
|
ddf19c |
return la->ino == lb->ino && la->dev == lb->dev;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
+static void fuse_lo_data_cleanup(struct lo_data *lo)
|
|
|
ddf19c |
+{
|
|
|
ddf19c |
+ if (lo->inodes) {
|
|
|
ddf19c |
+ g_hash_table_destroy(lo->inodes);
|
|
|
ddf19c |
+ }
|
|
|
ddf19c |
+ lo_map_destroy(&lo->fd_map);
|
|
|
ddf19c |
+ lo_map_destroy(&lo->dirp_map);
|
|
|
ddf19c |
+ lo_map_destroy(&lo->ino_map);
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ if (lo->proc_self_fd >= 0) {
|
|
|
ddf19c |
+ close(lo->proc_self_fd);
|
|
|
ddf19c |
+ }
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ if (lo->root.fd >= 0) {
|
|
|
ddf19c |
+ close(lo->root.fd);
|
|
|
ddf19c |
+ }
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ free(lo->source);
|
|
|
ddf19c |
+}
|
|
|
ddf19c |
+
|
|
|
ddf19c |
int main(int argc, char *argv[])
|
|
|
ddf19c |
{
|
|
|
ddf19c |
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
|
|
ddf19c |
@@ -2554,22 +2574,7 @@ err_out2:
|
|
|
ddf19c |
err_out1:
|
|
|
ddf19c |
fuse_opt_free_args(&args);
|
|
|
ddf19c |
|
|
|
ddf19c |
- if (lo.inodes) {
|
|
|
ddf19c |
- g_hash_table_destroy(lo.inodes);
|
|
|
ddf19c |
- }
|
|
|
ddf19c |
- lo_map_destroy(&lo.fd_map);
|
|
|
ddf19c |
- lo_map_destroy(&lo.dirp_map);
|
|
|
ddf19c |
- lo_map_destroy(&lo.ino_map);
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- if (lo.proc_self_fd >= 0) {
|
|
|
ddf19c |
- close(lo.proc_self_fd);
|
|
|
ddf19c |
- }
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- if (lo.root.fd >= 0) {
|
|
|
ddf19c |
- close(lo.root.fd);
|
|
|
ddf19c |
- }
|
|
|
ddf19c |
-
|
|
|
ddf19c |
- free(lo.source);
|
|
|
ddf19c |
+ fuse_lo_data_cleanup(&lo);
|
|
|
ddf19c |
|
|
|
ddf19c |
return ret ? 1 : 0;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|