From 63bde484ad8aba007b52f19cad5bba903cc82808 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 17 Aug 2015 11:27:15 -0400 Subject: [PATCH] Fix iscsi issue (rhbz 1253789) --- ...on-recovery_tmo-sysfs-writes-persist.patch | 89 +++++++++++++++++++ kernel.spec | 6 ++ 2 files changed, 95 insertions(+) create mode 100644 iSCSI-let-session-recovery_tmo-sysfs-writes-persist.patch diff --git a/iSCSI-let-session-recovery_tmo-sysfs-writes-persist.patch b/iSCSI-let-session-recovery_tmo-sysfs-writes-persist.patch new file mode 100644 index 000000000..174cccb02 --- /dev/null +++ b/iSCSI-let-session-recovery_tmo-sysfs-writes-persist.patch @@ -0,0 +1,89 @@ +From 9c8108a4d3a837c51a29f28229a06d97654eaeb6 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Tue, 16 Jun 2015 16:07:13 -0700 +Subject: iSCSI: let session recovery_tmo sysfs writes persist across recovery + +The iSCSI session recovery_tmo setting is writeable in sysfs, but it's +also set every time a connection is established when parameters are set +from iscsid over netlink. That results in the timeout being reset to +the default value after every recovery. + +The DM multipath tools want to use the sysfs interface to lower the +default timeout when there are multiple paths to fail over. It has +caused confusion that we have a writeable sysfs value that seem to keep +resetting itself. + +This patch adds an in-kernel flag that gets set once a sysfs write +occurs, and then ignores netlink parameter setting once it's been +modified via the sysfs interface. My thinking here is that the sysfs +interface is much simpler for external tools to influence the session +timeout, but if we're going to allow it to be modified directly we +should ensure that setting is maintained. + +Signed-off-by: Chris Leech +Reviewed-by: Mike Christie +Signed-off-by: James Bottomley + +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c +index 55647aa..4c25539 100644 +--- a/drivers/scsi/scsi_transport_iscsi.c ++++ b/drivers/scsi/scsi_transport_iscsi.c +@@ -2042,6 +2042,7 @@ iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport, + session->transport = transport; + session->creator = -1; + session->recovery_tmo = 120; ++ session->recovery_tmo_sysfs_override = false; + session->state = ISCSI_SESSION_FREE; + INIT_DELAYED_WORK(&session->recovery_work, session_recovery_timedout); + INIT_LIST_HEAD(&session->sess_list); +@@ -2786,7 +2787,8 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev) + switch (ev->u.set_param.param) { + case ISCSI_PARAM_SESS_RECOVERY_TMO: + sscanf(data, "%d", &value); +- session->recovery_tmo = value; ++ if (!session->recovery_tmo_sysfs_override) ++ session->recovery_tmo = value; + break; + default: + err = transport->set_param(conn, ev->u.set_param.param, +@@ -4049,13 +4051,15 @@ store_priv_session_##field(struct device *dev, \ + if ((session->state == ISCSI_SESSION_FREE) || \ + (session->state == ISCSI_SESSION_FAILED)) \ + return -EBUSY; \ +- if (strncmp(buf, "off", 3) == 0) \ ++ if (strncmp(buf, "off", 3) == 0) { \ + session->field = -1; \ +- else { \ ++ session->field##_sysfs_override = true; \ ++ } else { \ + val = simple_strtoul(buf, &cp, 0); \ + if (*cp != '\0' && *cp != '\n') \ + return -EINVAL; \ + session->field = val; \ ++ session->field##_sysfs_override = true; \ + } \ + return count; \ + } +@@ -4066,6 +4070,7 @@ store_priv_session_##field(struct device *dev, \ + static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUSR, \ + show_priv_session_##field, \ + store_priv_session_##field) ++ + iscsi_priv_session_rw_attr(recovery_tmo, "%d"); + + static struct attribute *iscsi_session_attrs[] = { +diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h +index 2555ee5..6183d20 100644 +--- a/include/scsi/scsi_transport_iscsi.h ++++ b/include/scsi/scsi_transport_iscsi.h +@@ -241,6 +241,7 @@ struct iscsi_cls_session { + + /* recovery fields */ + int recovery_tmo; ++ bool recovery_tmo_sysfs_override; + struct delayed_work recovery_work; + + unsigned int target_id; +-- +cgit v0.10.2 + diff --git a/kernel.spec b/kernel.spec index ecde67574..78c7a6df6 100644 --- a/kernel.spec +++ b/kernel.spec @@ -590,6 +590,9 @@ Patch508: kexec-uefi-copy-secure_boot-flag-in-boot-params.patch #rhbz 1239050 Patch509: ideapad-laptop-Add-Lenovo-Yoga-3-14-to-no_hw_rfkill-.patch +#rhbz 1253789 +Patch510: iSCSI-let-session-recovery_tmo-sysfs-writes-persist.patch + Patch904: kdbus.patch # END OF PATCH DEFINITIONS @@ -2027,6 +2030,9 @@ fi # # %changelog +* Mon Aug 17 2015 Josh Boyer +- Fix iscsi issue (rhbz 1253789) + * Mon Aug 17 2015 Josh Boyer - 4.2.0-0.rc7.git0.1 - Linux v4.2-rc7