aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2016-02-27 21:15:46 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-17 03:27:05 -0400
commit8f0dfb3d8b1120c61f6e2cc3729290db10772b2d (patch)
tree661cb7b2a3eb10bca89217bd064e10a4a5149190
parentff7199b04f08e1a72637ba66cd2c05842dc592d0 (diff)
iscsi-target: Fix early sk_data_ready LOGIN_FLAGS_READY race
There is a iscsi-target/tcp login race in LOGIN_FLAGS_READY state assignment that can result in frequent errors during iscsi discovery: "iSCSI Login negotiation failed." To address this bug, move the initial LOGIN_FLAGS_READY assignment ahead of iscsi_target_do_login() when handling the initial iscsi_target_start_negotiation() request PDU during connection login. As iscsi_target_do_login_rx() work_struct callback is clearing LOGIN_FLAGS_READ_ACTIVE after subsequent calls to iscsi_target_do_login(), the early sk_data_ready ahead of the first iscsi_target_do_login() expects LOGIN_FLAGS_READY to also be set for the initial login request PDU. As reported by Maged, this was first obsered using an MSFT initiator running across multiple VMWare host virtual machines with iscsi-target/tcp. Reported-by: Maged Mokhtar <mmokhtar@binarykinetics.com> Tested-by: Maged Mokhtar <mmokhtar@binarykinetics.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/iscsi/iscsi_target_nego.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index ca061320f5eb..89d34bd6d87f 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -1247,16 +1247,16 @@ int iscsi_target_start_negotiation(
1247{ 1247{
1248 int ret; 1248 int ret;
1249 1249
1250 ret = iscsi_target_do_login(conn, login); 1250 if (conn->sock) {
1251 if (!ret) { 1251 struct sock *sk = conn->sock->sk;
1252 if (conn->sock) {
1253 struct sock *sk = conn->sock->sk;
1254 1252
1255 write_lock_bh(&sk->sk_callback_lock); 1253 write_lock_bh(&sk->sk_callback_lock);
1256 set_bit(LOGIN_FLAGS_READY, &conn->login_flags); 1254 set_bit(LOGIN_FLAGS_READY, &conn->login_flags);
1257 write_unlock_bh(&sk->sk_callback_lock); 1255 write_unlock_bh(&sk->sk_callback_lock);
1258 } 1256 }
1259 } else if (ret < 0) { 1257
1258 ret = iscsi_target_do_login(conn, login);
1259 if (ret < 0) {
1260 cancel_delayed_work_sync(&conn->login_work); 1260 cancel_delayed_work_sync(&conn->login_work);
1261 cancel_delayed_work_sync(&conn->login_cleanup_work); 1261 cancel_delayed_work_sync(&conn->login_cleanup_work);
1262 iscsi_target_restore_sock_callbacks(conn); 1262 iscsi_target_restore_sock_callbacks(conn);