fix regression in network interface binding

Resolves: #1168556
This commit is contained in:
Chris Leech 2015-01-15 10:19:41 -08:00
parent 0fab0a7413
commit 705c811a7c
3 changed files with 139 additions and 5 deletions

View File

@ -0,0 +1,129 @@
From 2966a9262df88fcfa971f988f93a9bf168600331 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Sun, 11 Jan 2015 21:36:24 -0800
Subject: [PATCH] fix regression in iscsi_tcp iface binding
The changes in "retry login for ISCSI_ERR_HOST_NOT_FOUND" caused
sessions using the iscsi_tcp transport bound to a network iface to fail
to connect due to the host lookup failing (iscsi_tcp hosts are
dynamically allocated per-session).
This marks transports that use a host fixed to a hardware offload device
with "bind_ep_required" and only requires a host lookup before starting
the connection if this flag is set.
Signed-off-by: Chris Leech <cleech@redhat.com>
---
usr/initiator.c | 30 ++++++++++++++++--------------
usr/transport.c | 6 ++++++
usr/transport.h | 1 +
3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/usr/initiator.c b/usr/initiator.c
index f54b708..1aadc9b 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -398,20 +398,22 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t, int *rc)
iscsi_session_init_params(session);
- hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc);
- if (!*rc) {
- /*
- * if the netdev or mac was set, then we are going to want
- * to want to bind the all the conns/eps to a specific host
- * if offload is used.
- */
- session->conn[0].bind_ep = 1;
- session->hostno = hostno;
- } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) {
- goto free_session;
- } else {
- *rc = 0;
- }
+ if (t->template->bind_ep_required) {
+ hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc);
+ if (!*rc) {
+ /*
+ * if the netdev or mac was set, then we are going to want
+ * to want to bind the all the conns/eps to a specific host
+ * if offload is used.
+ */
+ session->conn[0].bind_ep = 1;
+ session->hostno = hostno;
+ } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) {
+ goto free_session;
+ } else {
+ *rc = 0;
+ }
+ }
list_add_tail(&session->list, &t->sessions);
return session;
diff --git a/usr/transport.c b/usr/transport.c
index 630f163..e778a6e 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -59,6 +59,7 @@ struct iscsi_transport_template iscsi_iser = {
struct iscsi_transport_template cxgb3i = {
.name = "cxgb3i",
.set_host_ip = SET_HOST_IP_OPT,
+ .bind_ep_required = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -68,6 +69,7 @@ struct iscsi_transport_template cxgb3i = {
struct iscsi_transport_template cxgb4i = {
.name = "cxgb4i",
.set_host_ip = SET_HOST_IP_NOT_REQ,
+ .bind_ep_required = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -78,6 +80,7 @@ struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.set_host_ip = SET_HOST_IP_REQ,
.use_boot_info = 1,
+ .bind_ep_required = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -86,6 +89,7 @@ struct iscsi_transport_template bnx2i = {
struct iscsi_transport_template be2iscsi = {
.name = "be2iscsi",
+ .bind_ep_required = 1,
.create_conn = be2iscsi_create_conn,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
@@ -95,6 +99,7 @@ struct iscsi_transport_template be2iscsi = {
struct iscsi_transport_template qla4xxx = {
.name = "qla4xxx",
.set_host_ip = SET_HOST_IP_NOT_REQ,
+ .bind_ep_required = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -102,6 +107,7 @@ struct iscsi_transport_template qla4xxx = {
struct iscsi_transport_template ocs = {
.name = "ocs",
+ .bind_ep_required = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 73041fa..831403b 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -38,6 +38,7 @@ struct iscsi_transport_template {
*/
uint8_t set_host_ip;
uint8_t use_boot_info;
+ uint8_t bind_ep_required;
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
--
2.1.0

View File

@ -16,7 +16,7 @@ index a090522..aef0c3d 100644
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "2.0-873"
+#define ISCSI_VERSION_STR "6.2.0.873-26"
+#define ISCSI_VERSION_STR "6.2.0.873-27"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif

View File

@ -4,7 +4,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 26%{?dist}
Release: 27%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -93,6 +93,7 @@ Patch81: 0081-iscsiadm-make-iface.ipaddress-optional-in-iface-conf.patch
Patch82: 0082-Remove-unused-variable-path.patch
Patch83: 0083-Parse-origin-value-from-iBFT.patch
Patch84: 0084-isns-Add-docs-for-deregistering-discovery-domains.patch
Patch114: 0114-fix-regression-in-iscsi_tcp-iface-binding.patch
# not (yet) upstream merged
Patch130: 0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch
@ -244,6 +245,7 @@ developing applications that use %{name}.
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch114 -p1
# pending upstream merge
%patch130 -p1
%patch140 -p1
@ -406,15 +408,15 @@ if [ $1 -gt 0 ]; then
cp $SRC $DST
fi
sed -i 's/RefuseManualStart=yes/RefuseManualStart=no/' $DST
/usr/bin/systemctl daemon-reload
/usr/bin/systemctl start remote-fs-pre.target
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
/usr/bin/systemctl start remote-fs-pre.target >/dev/null 2>&1 || :
fi
fi
fi
%triggerun -- iscsi-initiator-utils < 6.2.0.873-26
if [ $1 -gt 0 ]; then
systemctl start iscsi-shutdown.service
systemctl start iscsi-shutdown.service >/dev/null 2>&1 || :
fi
%files
@ -461,6 +463,9 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Thu Jan 15 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-27
- 1168556 fix regression in network interface binding
* Mon Jan 12 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-26
- 1166713 created iscsi-shutdown.service to ensure that session cleanup happens