aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/iscsi_tcp.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index c7e2ff24ee9e..2b1b834a098b 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -109,11 +109,14 @@ static int iscsi_sw_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
109 */ 109 */
110static inline int iscsi_sw_sk_state_check(struct sock *sk) 110static inline int iscsi_sw_sk_state_check(struct sock *sk)
111{ 111{
112 if ((sk->sk_state == TCP_CLOSE_WAIT || 112 struct iscsi_conn *conn = (struct iscsi_conn*)sk->sk_user_data;
113 sk->sk_state == TCP_CLOSE) &&
114 !atomic_read(&sk->sk_rmem_alloc))
115 return -ECONNRESET;
116 113
114 if ((sk->sk_state == TCP_CLOSE_WAIT || sk->sk_state == TCP_CLOSE) &&
115 !atomic_read(&sk->sk_rmem_alloc)) {
116 ISCSI_SW_TCP_DBG(conn, "TCP_CLOSE|TCP_CLOSE_WAIT\n");
117 iscsi_conn_failure(conn, ISCSI_ERR_TCP_CONN_CLOSE);
118 return -ECONNRESET;
119 }
117 return 0; 120 return 0;
118} 121}
119 122
@@ -135,11 +138,7 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk, int flag)
135 rd_desc.count = 1; 138 rd_desc.count = 1;
136 tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); 139 tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv);
137 140
138 if (iscsi_sw_sk_state_check(sk) < 0) { 141 iscsi_sw_sk_state_check(sk);
139 ISCSI_SW_TCP_DBG(conn, "iscsi_tcp_data_ready: "
140 "TCP_CLOSE|TCP_CLOSE_WAIT\n");
141 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
142 }
143 142
144 read_unlock(&sk->sk_callback_lock); 143 read_unlock(&sk->sk_callback_lock);
145 144
@@ -161,11 +160,7 @@ static void iscsi_sw_tcp_state_change(struct sock *sk)
161 conn = (struct iscsi_conn*)sk->sk_user_data; 160 conn = (struct iscsi_conn*)sk->sk_user_data;
162 session = conn->session; 161 session = conn->session;
163 162
164 if (iscsi_sw_sk_state_check(sk) < 0) { 163 iscsi_sw_sk_state_check(sk);
165 ISCSI_SW_TCP_DBG(conn, "iscsi_tcp_state_change: "
166 "TCP_CLOSE|TCP_CLOSE_WAIT\n");
167 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
168 }
169 164
170 tcp_conn = conn->dd_data; 165 tcp_conn = conn->dd_data;
171 tcp_sw_conn = tcp_conn->dd_data; 166 tcp_sw_conn = tcp_conn->dd_data;