diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-09-24 22:45:01 -0700 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-09-24 22:45:01 -0700 |
commit | 1cfb9d628fa24c0a8b24cd604ae62dfa10a0d716 (patch) | |
tree | 4e57e7465ce5fbc2a6cc838fd78e5e8a2b9799ff /drivers/target/iscsi/iscsi_target_login.c | |
parent | d595150285cf886cf2399fd74b0eeb43b444c706 (diff) | |
parent | 7ecc9777c5c76d7b31c376ffd4f59c4a85472a1b (diff) |
Merge branch 'linux-linaro-lsk-v4.9' into v4.9/topic/ionv4.9/topic/ion
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_login.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 6128e8e80170..9ccd5da8f204 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -1233,9 +1233,11 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) flush_signals(current); spin_lock_bh(&np->np_thread_lock); - if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { + if (atomic_dec_if_positive(&np->np_reset_count) >= 0) { np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; + spin_unlock_bh(&np->np_thread_lock); complete(&np->np_restart_comp); + return 1; } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) { spin_unlock_bh(&np->np_thread_lock); goto exit; @@ -1268,7 +1270,8 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) goto exit; } else if (rc < 0) { spin_lock_bh(&np->np_thread_lock); - if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { + if (atomic_dec_if_positive(&np->np_reset_count) >= 0) { + np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; spin_unlock_bh(&np->np_thread_lock); complete(&np->np_restart_comp); iscsit_put_transport(conn->conn_transport); |