114 lines
3.9 KiB
Diff
114 lines
3.9 KiB
Diff
|
diff -aurp open-iscsi-6.2.0.695/usr/initiator.c open-iscsi-6.2.0.695.qla4xxx/usr/initiator.c
|
||
|
--- open-iscsi-6.2.0.695/usr/initiator.c 2006-09-06 16:22:44.000000000 -0500
|
||
|
+++ open-iscsi-6.2.0.695.qla4xxx/usr/initiator.c 2006-09-15 15:16:57.000000000 -0500
|
||
|
@@ -1524,11 +1524,17 @@ static int match_session(void *data, cha
|
||
|
int port, int sid)
|
||
|
{
|
||
|
node_rec_t *rec = data;
|
||
|
+ iscsi_provider_t *p;
|
||
|
|
||
|
- log_debug(6, "looking for session [%s,%s,%d]",
|
||
|
+ log_debug(6, "looking for session [%d][%s,%s,%d]", sid,
|
||
|
rec->name, rec->conn[0].address, rec->conn[0].port);
|
||
|
|
||
|
- if (!strncmp(rec->name, targetname, strlen(rec->name)) &&
|
||
|
+ p = get_transport_by_sid(sid);
|
||
|
+ if (!p)
|
||
|
+ return 0;
|
||
|
+
|
||
|
+ if (!strcmp(rec->transport_name, p->name) &&
|
||
|
+ !strncmp(rec->name, targetname, strlen(rec->name)) &&
|
||
|
!strncmp(rec->conn[0].address, address,
|
||
|
strlen(rec->conn[0].address)) &&
|
||
|
rec->conn[0].port == port)
|
||
|
@@ -1555,7 +1561,8 @@ session_find_by_rec(node_rec_t *rec)
|
||
|
|
||
|
if (match_session(rec, session->nrec.name,
|
||
|
-1, session->nrec.conn[0].address,
|
||
|
- session->nrec.conn[0].port, -1))
|
||
|
+ session->nrec.conn[0].port,
|
||
|
+ session->id))
|
||
|
return session;
|
||
|
|
||
|
sitem = sitem->q_forw;
|
||
|
diff -aurp open-iscsi-6.2.0.695/usr/iscsid.c open-iscsi-6.2.0.695.qla4xxx/usr/iscsid.c
|
||
|
--- open-iscsi-6.2.0.695/usr/iscsid.c 2006-09-06 02:16:07.000000000 -0500
|
||
|
+++ open-iscsi-6.2.0.695.qla4xxx/usr/iscsid.c 2006-09-15 15:08:59.000000000 -0500
|
||
|
@@ -97,20 +97,28 @@ static int sync_session(void *data, char
|
||
|
int fd = -1;
|
||
|
iscsiadm_req_t req;
|
||
|
iscsiadm_rsp_t rsp;
|
||
|
+ iscsi_provider_t *p;
|
||
|
|
||
|
log_debug(7, "sync session [%d][%s,%s.%d]\n", sid, targetname, address,
|
||
|
port);
|
||
|
|
||
|
- /* for now skip qlogic and other HW and offload drivers */
|
||
|
- if (!get_transport_by_sid(sid))
|
||
|
+ p = get_transport_by_sid(sid);
|
||
|
+ if (!p)
|
||
|
return 0;
|
||
|
|
||
|
if (idbm_node_read(db, &rec, targetname, address, port)) {
|
||
|
- log_error("could not read data for [%s,%s.%d]\n",
|
||
|
- targetname, address, port);
|
||
|
+ log_warning("could not read data for [%s,%s.%d]\n",
|
||
|
+ targetname, address, port);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
+ /*
|
||
|
+ * for now skip qlogic and other HW and offload driver that
|
||
|
+ * that store their data somewhere else
|
||
|
+ */
|
||
|
+ if (strcmp(p->name, rec.transport_name))
|
||
|
+ return 0;
|
||
|
+
|
||
|
memset(&req, 0, sizeof(req));
|
||
|
req.command = MGMT_IPC_SESSION_SYNC;
|
||
|
req.u.session.sid = sid;
|
||
|
diff -aurp open-iscsi-6.2.0.695/usr/iscsi_sysfs.c open-iscsi-6.2.0.695.qla4xxx/usr/iscsi_sysfs.c
|
||
|
--- open-iscsi-6.2.0.695/usr/iscsi_sysfs.c 2006-09-06 16:22:44.000000000 -0500
|
||
|
+++ open-iscsi-6.2.0.695.qla4xxx/usr/iscsi_sysfs.c 2006-09-15 14:52:14.000000000 -0500
|
||
|
@@ -164,16 +164,36 @@ int get_sessioninfo_by_sysfs_id(int *sid
|
||
|
"persistent_address", *sid);
|
||
|
memset(addr, 0, NI_MAXHOST);
|
||
|
ret = read_sysfs_file(sysfs_file, addr, "%s\n");
|
||
|
- if (ret)
|
||
|
- log_debug(5, "could not read conn addr: %d", ret);
|
||
|
+ if (ret) {
|
||
|
+ /* fall back to current address */
|
||
|
+ log_debug(5, "could not read pers conn addr: %d", ret);
|
||
|
+ memset(sysfs_file, 0, PATH_MAX);
|
||
|
+ sprintf(sysfs_file,
|
||
|
+ "/sys/class/iscsi_connection/connection%d:0/address",
|
||
|
+ *sid);
|
||
|
+ memset(addr, 0, NI_MAXHOST);
|
||
|
+ ret = read_sysfs_file(sysfs_file, addr, "%s\n");
|
||
|
+ if (ret)
|
||
|
+ log_debug(5, "could not read curr addr: %d", ret);
|
||
|
+ }
|
||
|
|
||
|
memset(sysfs_file, 0, PATH_MAX);
|
||
|
sprintf(sysfs_file, "/sys/class/iscsi_connection/connection%d:0/"
|
||
|
"persistent_port", *sid);
|
||
|
*port = -1;
|
||
|
ret = read_sysfs_file(sysfs_file, port, "%u\n");
|
||
|
- if (ret)
|
||
|
- log_debug(5, "Could not read conn port %d\n", ret);
|
||
|
+ if (ret) {
|
||
|
+ /* fall back to current port */
|
||
|
+ log_debug(5, "Could not read pers conn port %d\n", ret);
|
||
|
+ memset(sysfs_file, 0, PATH_MAX);
|
||
|
+ sprintf(sysfs_file,
|
||
|
+ "/sys/class/iscsi_connection/connection%d:0/port",
|
||
|
+ *sid);
|
||
|
+ *port = -1;
|
||
|
+ ret = read_sysfs_file(sysfs_file, port, "%u\n");
|
||
|
+ if (ret)
|
||
|
+ log_debug(5, "Could not read curr conn port %d\n", ret);
|
||
|
+ }
|
||
|
|
||
|
log_debug(7, "found targetname %s address %s port %d\n",
|
||
|
targetname, addr ? addr : "NA", *port);
|