Target/iscsi,iser: Avoid accepting transport connections during stop stage
authorSagi Grimberg <sagig@mellanox.com>
Tue, 29 Apr 2014 10:13:47 +0000 (13:13 +0300)
committerJiri Slaby <jslaby@suse.cz>
Fri, 20 Jun 2014 15:34:15 +0000 (17:34 +0200)
commit 14f4b54fe38f3a8f8392a50b951c8aa43b63687a upstream.

When the target is in stop stage, iSER transport initiates RDMA disconnects.
The iSER initiator may wish to establish a new connection over the
still existing network portal. In this case iSER transport should not
accept and resume new RDMA connections. In order to learn that, iscsi_np
is added with enabled flag so the iSER transport can check when deciding
weather to accept and resume a new connection request.

The iscsi_np is enabled after successful transport setup, and disabled
before iscsi_np login threads are cleaned up.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/infiniband/ulp/isert/ib_isert.c
drivers/target/iscsi/iscsi_target_core.h
drivers/target/iscsi/iscsi_target_login.c
drivers/target/iscsi/iscsi_target_tpg.c

index 8f23786c74e970e852e5dd264223f6665aa39597..8645d19f771002655c47101d7b3af01e507ccace 100644 (file)
@@ -493,6 +493,14 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        struct ib_device *ib_dev = cma_id->device;
        int ret = 0;
 
+       spin_lock_bh(&np->np_thread_lock);
+       if (!np->enabled) {
+               spin_unlock_bh(&np->np_thread_lock);
+               pr_debug("iscsi_np is not enabled, reject connect request\n");
+               return rdma_reject(cma_id, NULL, 0);
+       }
+       spin_unlock_bh(&np->np_thread_lock);
+
        pr_debug("Entering isert_connect_request cma_id: %p, context: %p\n",
                 cma_id, cma_id->context);
 
index 9a5721b8ff96f83edee065f8d27d933e3aad33ac..e2e1e63237d99ea5672480de0a9fba488757c33f 100644 (file)
@@ -777,6 +777,7 @@ struct iscsi_np {
        int                     np_ip_proto;
        int                     np_sock_type;
        enum np_thread_state_table np_thread_state;
+       bool                    enabled;
        enum iscsi_timer_flags_table np_login_timer_flags;
        u32                     np_exports;
        enum np_flags_table     np_flags;
index f442a9c9340376184bba6aa2adc7eca0b451f743..f140a0eac985fec2db4f8558ea508a44d8504568 100644 (file)
@@ -983,6 +983,7 @@ int iscsi_target_setup_login_socket(
        }
 
        np->np_transport = t;
+       np->enabled = true;
        return 0;
 }
 
index 3cf77c0b76b4c7e122cf3f45904a9607427cbacc..adc9393f79e50dcec1a320ba10f79201a1adf410 100644 (file)
@@ -184,6 +184,7 @@ static void iscsit_clear_tpg_np_login_thread(
                return;
        }
 
+       tpg_np->tpg_np->enabled = false;
        iscsit_reset_np_thread(tpg_np->tpg_np, tpg_np, tpg, shutdown);
 }