58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsid.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsid.c
|
|
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsid.c 2011-11-01 19:15:46.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsid.c 2011-11-01 19:17:45.000000000 -0500
|
|
@@ -221,6 +221,9 @@ static int sync_session(void *data, stru
|
|
return 0;
|
|
}
|
|
|
|
+ if (!iscsi_sysfs_session_user_created(info->sid))
|
|
+ return 0;
|
|
+
|
|
memset(&rec, 0, sizeof(node_rec_t));
|
|
/*
|
|
* We might get the local ip address for software. We do not
|
|
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c
|
|
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c 2011-11-01 19:15:46.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c 2011-11-01 19:17:45.000000000 -0500
|
|
@@ -231,6 +231,29 @@ void iscsi_sysfs_get_negotiated_session_
|
|
&conf->MaxOutstandingR2T);
|
|
}
|
|
|
|
+/*
|
|
+ * iscsi_sysfs_session_user_created - return if session was setup by userspace
|
|
+ * @sid: id of session to test
|
|
+ *
|
|
+ * Returns -1 if we could not tell due to kernel not supporting the
|
|
+ * feature. 0 is returned if kernel created it. And 1 is returned
|
|
+ * if userspace created it.
|
|
+ */
|
|
+int iscsi_sysfs_session_user_created(int sid)
|
|
+{
|
|
+ char id[NAME_SIZE];
|
|
+ pid_t pid;
|
|
+
|
|
+ snprintf(id, sizeof(id), ISCSI_SESSION_ID, sid);
|
|
+ if (sysfs_get_int(id, ISCSI_SESSION_SUBSYS, "creator", &pid))
|
|
+ return -1;
|
|
+
|
|
+ if (pid == -1)
|
|
+ return 0;
|
|
+ else
|
|
+ return 1;
|
|
+}
|
|
+
|
|
uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err)
|
|
{
|
|
struct sysfs_device *session_dev, *host_dev;
|
|
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.h open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.h
|
|
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.h 2011-11-01 19:15:46.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.h 2011-11-01 19:17:45.000000000 -0500
|
|
@@ -90,6 +90,7 @@ extern struct iscsi_transport *iscsi_sys
|
|
extern struct iscsi_transport *iscsi_sysfs_get_transport_by_sid(uint32_t sid);
|
|
extern struct iscsi_transport *iscsi_sysfs_get_transport_by_name(char *transport_name);
|
|
extern int iscsi_sysfs_session_supports_nop(int sid);
|
|
+extern int iscsi_sysfs_session_user_created(int sid);
|
|
|
|
extern struct list_head transports;
|
|
|