1c8eda
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c
1c8eda
--- open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c	2010-05-18 17:57:59.000000000 -0500
1c8eda
+++ open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c	2010-05-18 17:58:43.000000000 -0500
1c8eda
@@ -40,6 +40,9 @@
1c8eda
 
1c8eda
 #define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; }
1c8eda
 
1c8eda
+/* UGLY, not thread safe :( */
1c8eda
+static int sysfs_initialized = 0;
1c8eda
+
1c8eda
 struct libiscsi_context {
1c8eda
 	char error_str[256];
1c8eda
 	/* For get_parameter_helper() */
1c8eda
@@ -66,7 +69,10 @@ struct libiscsi_context *libiscsi_init(v
1c8eda
 		return NULL;
1c8eda
 
1c8eda
 	log_init("libiscsi", 1024, libiscsi_log, context);
1c8eda
-	sysfs_init();
1c8eda
+	if (!sysfs_initialized) {
1c8eda
+		sysfs_init();
1c8eda
+		sysfs_initialized = 1;
1c8eda
+	}
1c8eda
 	increase_max_files();
1c8eda
 	if (idbm_init(NULL)) {
1c8eda
 		sysfs_cleanup();
1c8eda
@@ -529,6 +535,11 @@ int libiscsi_get_firmware_network_config
1c8eda
 {
1c8eda
 	struct boot_context fw_entry;
1c8eda
 
1c8eda
+	if (!sysfs_initialized) {
1c8eda
+		sysfs_init();
1c8eda
+		sysfs_initialized = 1;
1c8eda
+	}
1c8eda
+
1c8eda
 	memset(config, 0, sizeof *config);
1c8eda
 	memset(&fw_entry, 0, sizeof fw_entry);
1c8eda
 	if (fw_get_entry(&fw_entry))
1c8eda
@@ -551,6 +562,11 @@ int libiscsi_get_firmware_initiator_name
1c8eda
 {
1c8eda
 	struct boot_context fw_entry;
1c8eda
 
1c8eda
+	if (!sysfs_initialized) {
1c8eda
+		sysfs_init();
1c8eda
+		sysfs_initialized = 1;
1c8eda
+	}
1c8eda
+
1c8eda
 	memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
1c8eda
 	memset(&fw_entry, 0, sizeof fw_entry);
1c8eda
 	if (fw_get_entry(&fw_entry))