[PATCH V2 1/8] tgtd: fork logger before initializing llds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently the logger is forked after LLDs are initialized/started, hence
file-descriptors opened during that initialization are duplicated during the
fork and remain open even when closed in the main thread.
The solution is to fork the logger before the LLDs are started.

Signed-off-by: Roi Dayan <roid@xxxxxxxxxxxx>
---
 usr/tgtd.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/usr/tgtd.c b/usr/tgtd.c
index cba2b66..f152715 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -552,12 +552,6 @@ int main(int argc, char **argv)
 
 	spare_args = optind < argc ? argv[optind] : NULL;
 
-	nr_lld = lld_init(spare_args);
-	if (!nr_lld) {
-		fprintf(stderr, "No available low level driver!\n");
-		exit(1);
-	}
-
 	err = ipc_init();
 	if (err)
 		exit(1);
@@ -565,15 +559,21 @@ int main(int argc, char **argv)
 	if (is_daemon && daemon(0,0))
 		exit(1);
 
-	err = oom_adjust();
+	err = log_init(program_name, LOG_SPACE_SIZE, is_daemon, is_debug);
 	if (err)
 		exit(1);
 
-	err = nr_file_adjust();
+	nr_lld = lld_init(spare_args);
+	if (!nr_lld) {
+		fprintf(stderr, "No available low level driver!\n");
+		exit(1);
+	}
+
+	err = oom_adjust();
 	if (err)
 		exit(1);
 
-	err = log_init(program_name, LOG_SPACE_SIZE, is_daemon, is_debug);
+	err = nr_file_adjust();
 	if (err)
 		exit(1);
 
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux