diff --git a/0114-fix-regression-in-iscsi_tcp-iface-binding.patch b/0114-fix-regression-in-iscsi_tcp-iface-binding.patch new file mode 100644 index 0000000..ff4da71 --- /dev/null +++ b/0114-fix-regression-in-iscsi_tcp-iface-binding.patch @@ -0,0 +1,129 @@ +From 2966a9262df88fcfa971f988f93a9bf168600331 Mon Sep 17 00:00:00 2001 +From: Chris Leech +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 +--- + 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 + diff --git a/0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch b/0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch new file mode 100644 index 0000000..fb9d7ec --- /dev/null +++ b/0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch @@ -0,0 +1,34 @@ +From 46bc7ff0091af95735c03995be7d6002b03944dd Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Mon, 17 Nov 2014 21:34:06 -0800 +Subject: [PATCH] guard against NULL ptr during discovery from unexpected event + +When demand loading drivers during discovery, iscsiadm can receive an +unexpected netlink event, like a link up, when looking for a discovery +session login status. That could expose krecv_conn_state to a +connection without a valid recv_context pointer. +Guard against that to prevent the NULL dereference. + +Signed-off-by: Chris Leech +--- + usr/netlink.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/usr/netlink.c b/usr/netlink.c +index 1c4b5cc..18be5e5 100644 +--- a/usr/netlink.c ++++ b/usr/netlink.c +@@ -1035,6 +1035,10 @@ static int krecv_conn_state(struct iscsi_conn *conn, uint32_t *state) + /* fatal handling error or conn error */ + goto exit; + ++ /* unexpected event without a receive context */ ++ if (!conn->recv_context) ++ return -EAGAIN; ++ + *state = *(enum iscsi_conn_state *)conn->recv_context->data; + + ipc_ev_clbk->put_ev_context(conn->recv_context); +-- +1.9.3 + diff --git a/0171-iscsiuio-strict-aliasing.patch b/0171-iscsiuio-strict-aliasing.patch new file mode 100644 index 0000000..1a0eb68 --- /dev/null +++ b/0171-iscsiuio-strict-aliasing.patch @@ -0,0 +1,26 @@ +diff --git a/iscsiuio/configure b/iscsiuio/configure +index 50cfd90..c930b67 100755 +--- a/iscsiuio/configure ++++ b/iscsiuio/configure +@@ -22782,7 +22782,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + +-CFLAGS="${CFLAGS} -O2 -Wall" ++CFLAGS="${CFLAGS} -O2 -Wall -fno-strict-aliasing" + ## check for --enable-debug first before checking CFLAGS before + ## so that we don't mix -O and -g + # Check whether --enable-debug was given. +diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac +index e4af3b2..551a513 100644 +--- a/iscsiuio/configure.ac ++++ b/iscsiuio/configure.ac +@@ -52,7 +52,7 @@ AC_LIBTOOL_DLOPEN + # libtool stuff + AC_PROG_LIBTOOL + +-CFLAGS="${CFLAGS} -O2 -Wall" ++CFLAGS="${CFLAGS} -O2 -Wall -fno-strict-aliasing" + ## check for --enable-debug first before checking CFLAGS before + ## so that we don't mix -O and -g + AC_ARG_ENABLE(debug, diff --git a/0172-move-cleanup-to-seperate-service.patch b/0172-move-cleanup-to-seperate-service.patch new file mode 100644 index 0000000..c7193ba --- /dev/null +++ b/0172-move-cleanup-to-seperate-service.patch @@ -0,0 +1,55 @@ +From 56d9d1c6a02dcad0915c0673f9cd2e653c86302f Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 13 Jan 2015 16:30:01 -0800 +Subject: [PATCH] 0171-make-session-shutdown-a-seperate-service.patch + +--- + etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++ + etc/systemd/iscsi.service | 3 +-- + 2 files changed, 15 insertions(+), 2 deletions(-) + create mode 100644 etc/systemd/iscsi-shutdown.service + +diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service +new file mode 100644 +index 0000000..23758e9 +--- /dev/null ++++ b/etc/systemd/iscsi-shutdown.service +@@ -0,0 +1,14 @@ ++[Unit] ++Description=Logout off all iSCSI sessions on shutdown ++Documentation=man:iscsid(8) man:iscsiadm(8) ++DefaultDependencies=no ++Conflicts=shutdown.target ++After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service ++Before=remote-fs-pre.target ++Wants=remote-fs-pre.target ++RefuseManualStop=yes ++ ++[Service] ++Type=oneshot ++RemainAfterExit=true ++ExecStop=-/sbin/iscsiadm -m node --logoutall=all +diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service +index ad7be34..2736956 100644 +--- a/etc/systemd/iscsi.service ++++ b/etc/systemd/iscsi.service +@@ -5,7 +5,7 @@ DefaultDependencies=no + Conflicts=shutdown.target + After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service + Before=remote-fs-pre.target +-Wants=remote-fs-pre.target ++Wants=remote-fs-pre.target iscsi-shutdown.service + ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes + ConditionDirectoryNotEmpty=|/sys/class/iscsi_session + +@@ -14,7 +14,6 @@ Type=oneshot + RemainAfterExit=true + ExecStart=-/usr/libexec/iscsi-mark-root-nodes + ExecStart=-/sbin/iscsiadm -m node --loginall=automatic +-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic + ExecReload=-/sbin/iscsiadm -m node --loginall=automatic + + [Install] +-- +2.1.0 + diff --git a/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch b/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch index 747c9da..3be2b70 100644 --- a/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +++ b/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -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-24" ++#define ISCSI_VERSION_STR "6.2.0.873-25" #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" #endif diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index 867df5c..93366a0 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -94,8 +94,10 @@ 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 Patch140: 0140-add-discovery-as-a-valid-mode-in-iscsiadm.8.patch Patch143: 0143-idmb_rec_write-check-for-tpgt-first.patch Patch145: 0145-idbm_rec_write-seperate-old-and-new-style-writes.patch @@ -107,7 +109,7 @@ Patch150: 0150-iscsi-boot-related-service-file-updates.patch Patch151: 0151-update-initscripts-and-docs.patch Patch152: 0152-use-var-for-config.patch Patch153: 0153-use-red-hat-for-name.patch -Patch154: libiscsi.patch +Patch154: 0154-add-libiscsi.patch Patch155: 0155-dont-use-static.patch Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch Patch159: 0159-iscsiuio-systemd-unit-files.patch @@ -120,7 +122,8 @@ Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch Patch168: 0168-update-handling-of-boot-sessions.patch Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch Patch170: 0170-fix-systemd-unit-wants.patch -Patch171: 0171-make-session-shutdown-a-seperate-service.patch +Patch171: 0171-iscsiuio-strict-aliasing.patch +Patch172: 0172-move-cleanup-to-seperate-service.patch # version string, needs to be updated with each build Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -174,7 +177,7 @@ cd iscsiuio %{configure} cd .. cd utils/open-isns -%{configure} --with-security=no +%{configure} --with-security=no --with-slp=no cd ../.. %{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod" @@ -243,7 +246,7 @@ popd %post /sbin/ldconfig -%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket +%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsid.socket if [ $1 -eq 1 ]; then if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then @@ -252,16 +255,28 @@ if [ $1 -eq 1 ]; then # enable socket activation and persistant session startup by default /bin/systemctl enable iscsi.service >/dev/null 2>&1 || : /bin/systemctl enable iscsid.socket >/dev/null 2>&1 || : +fi + +%post iscsiuio +%systemd_post iscsiuio.service iscsiuio.socket + +if [ $1 -eq 1 ]; then /bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || : fi %preun %systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket +%preun iscsiuio +%systemd_preun iscsiuio.service iscsiuio.socket + %postun /sbin/ldconfig %systemd_postun +%postun iscsiuio +%systemd_postun + %triggerun -- iscsi-initiator-utils < 6.2.0.873-1 # Save the current service runlevel info # User must manually run systemd-sysv-convert --apply iscsid @@ -280,6 +295,10 @@ fi /bin/systemctl try-restart iscsid.service >/dev/null 2>&1 || : /bin/systemctl try-restart iscsi.service >/dev/null 1>&1 || : +%triggerun iscsiuio -- iscsi-initiator-utils < 6.2.0.873-1 +# enable socket activation +/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || : + %triggerun -- iscsi-initiator-utils < 6.2.0.873-24 # prior to 6.2.0.873-24 iscsi.service was missing a Wants=remote-fs-pre.target # this forces remote-fs-pre.target active if needed for a clean shutdown/reboot @@ -295,16 +314,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-25 -# prior to 6.2.0.873-25 there was no seperate iscsi-shutdown.service if [ $1 -gt 0 ]; then - systemctl start iscsi-shutdown.service + systemctl start iscsi-shutdown.service >/dev/null 2>&1 || : fi %files @@ -355,6 +373,12 @@ fi * Wed Jan 28 2015 Chris Leech - 6.2.0.873-25.gitc9d830b - split out session logout on shutdown to a separate service - 985321 roll up libiscsi patches, update python bindings to support python3 +- scriptlets were never split out properly for the iscsiuio subpackage +- fix regression in network interface binding +- created iscsi-shutdown.service to ensure that session cleanup happens +- Add --with-slp=no +- segfault from unexpected netlink event during discovery +- inhibit strict aliasing optimizations in iscsiuio, rpmdiff error * Thu Oct 23 2014 Chris Leech - 6.2.0.873-24.gitc9d830b - sync with upstream v2.0.873-84-gc9d830b