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