]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 25 Apr 2017 17:55:12 +0000 (10:55 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 20 Jun 2017 10:17:15 +0000 (12:17 +0200)
BugLink: http://bugs.launchpad.net/bugs/1692900
commit 197b806ae5db60c6f609d74da04ddb62ea5e1b00 upstream.

While testing modification of per se_node_acl queue_depth forcing
session reinstatement via lio_target_nacl_cmdsn_depth_store() ->
core_tpg_set_initiator_node_queue_depth(), a hung task bug triggered
when changing cmdsn_depth invoked session reinstatement while an iscsi
login was already waiting for session reinstatement to complete.

This can happen when an outstanding se_cmd descriptor is taking a
long time to complete, and session reinstatement from iscsi login
or cmdsn_depth change occurs concurrently.

To address this bug, explicitly set session_fall_back_to_erl0 = 1
when forcing session reinstatement, so session reinstatement is
not attempted if an active session is already being shutdown.

This patch has been tested with two scenarios.  The first when
iscsi login is blocked waiting for iscsi session reinstatement
to complete followed by queue_depth change via configfs, and
second when queue_depth change via configfs us blocked followed
by a iscsi login driven session reinstatement.

Note this patch depends on commit d36ad77f702 to handle multiple
sessions per se_node_acl when changing cmdsn_depth, and for
pre v4.5 kernels will need to be included for stable as well.

Reported-by: Gary Guo <ghg@datera.io>
Tested-by: Gary Guo <ghg@datera.io>
Cc: Gary Guo <ghg@datera.io>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target_configfs.c
drivers/target/iscsi/iscsi_target_login.c

index 6ed80b05d674bc5a18da5e70899fecebfed4a621..200d3de8bc1e8a8303d3169813d957f1732206d8 100644 (file)
@@ -4821,6 +4821,7 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force)
                        continue;
                }
                atomic_set(&sess->session_reinstatement, 1);
+               atomic_set(&sess->session_fall_back_to_erl0, 1);
                spin_unlock(&sess->conn_lock);
 
                list_move_tail(&se_sess->sess_list, &free_list);
index 2f821de6304985d552fba6f2d68cdd9f49707b7c..dc1bd1f1bdfe3b6990dd13570ab46a1085e56f31 100644 (file)
@@ -1608,6 +1608,7 @@ static int lio_tpg_shutdown_session(struct se_session *se_sess)
                return 0;
        }
        atomic_set(&sess->session_reinstatement, 1);
+       atomic_set(&sess->session_fall_back_to_erl0, 1);
        spin_unlock(&sess->conn_lock);
 
        iscsit_stop_time2retain_timer(sess);
index 316f661723350f0872cabdba7571d868b2e4d212..4a137b0ae3dc11d09bfbf6941bc9d7c2e3b0558a 100644 (file)
@@ -195,6 +195,7 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn)
                            initiatorname_param->value) &&
                   (sess_p->sess_ops->SessionType == sessiontype))) {
                        atomic_set(&sess_p->session_reinstatement, 1);
+                       atomic_set(&sess_p->session_fall_back_to_erl0, 1);
                        spin_unlock(&sess_p->conn_lock);
                        iscsit_inc_session_usage_count(sess_p);
                        iscsit_stop_time2retain_timer(sess_p);