Target/iser: Bail from accept_np if np_thread is trying to close
authorSagi Grimberg <sagig@mellanox.com>
Mon, 19 May 2014 14:44:22 +0000 (17:44 +0300)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 19 May 2014 21:32:58 +0000 (14:32 -0700)
In case np_thread state is in RESET/SHUTDOWN/EXIT states,
no point for isert to stall there as we may get a hang in
case no one will wake it up later.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/isert/ib_isert.c

index a1710465faaf2345ae9c88755790e3e74a6e76e8..7676bcb7105aac073202cc29e3231bea26dbc23d 100644 (file)
@@ -3154,9 +3154,14 @@ accept_wait:
                return -ENODEV;
 
        spin_lock_bh(&np->np_thread_lock);
-       if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
+       if (np->np_thread_state >= ISCSI_NP_THREAD_RESET) {
                spin_unlock_bh(&np->np_thread_lock);
-               pr_debug("ISCSI_NP_THREAD_RESET for isert_accept_np\n");
+               pr_debug("np_thread_state %d for isert_accept_np\n",
+                        np->np_thread_state);
+               /**
+                * No point in stalling here when np_thread
+                * is in state RESET/SHUTDOWN/EXIT - bail
+                **/
                return -ENODEV;
        }
        spin_unlock_bh(&np->np_thread_lock);