diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 20:53:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 20:53:36 -0400 |
commit | 39695224bd84dc4be29abad93a0ec232a16fc519 (patch) | |
tree | 2bfa5cb50788a4c8be9f2e9f4412e47a565f4508 /drivers/scsi/iscsi_tcp.c | |
parent | a9bbd210a44102cc50b30a5f3d111dbf5f2f9cd4 (diff) | |
parent | ea038f63ac52439e7816295fa6064fe95e6c1f51 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (209 commits)
[SCSI] fix oops during scsi scanning
[SCSI] libsrp: fix memory leak in srp_ring_free()
[SCSI] libiscsi, bnx2i: make bound ep check common
[SCSI] libiscsi: add completion function for drivers that do not need pdu processing
[SCSI] scsi_dh_rdac: changes for rdac debug logging
[SCSI] scsi_dh_rdac: changes to collect the rdac debug information during the initialization
[SCSI] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach
[SCSI] sg: fix oops in the error path in sg_build_indirect()
[SCSI] mptsas : Bump version to 3.04.12
[SCSI] mptsas : FW event thread and scsi mid layer deadlock in SYNCHRONIZE CACHE command
[SCSI] mptsas : Send DID_NO_CONNECT for pending IOs of removed device
[SCSI] mptsas : PAE Kernel more than 4 GB kernel panic
[SCSI] mptsas : NULL pointer on big endian systems causing Expander not to tear off
[SCSI] mptsas : Sanity check for phyinfo is added
[SCSI] scsi_dh_rdac: Add support for Sun StorageTek ST2500, ST2510 and ST2530
[SCSI] pmcraid: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller
[SCSI] qla2xxx: Update version number to 8.03.01-k6.
[SCSI] qla2xxx: Properly delete rports attached to a vport.
[SCSI] qla2xxx: Correct various NPIV issues.
[SCSI] qla2xxx: Correct qla2x00_eh_wait_on_command() to wait correctly.
...
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 518dbd91df85..2b1b834a098b 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -99,6 +99,27 @@ static int iscsi_sw_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, | |||
99 | return total_consumed; | 99 | return total_consumed; |
100 | } | 100 | } |
101 | 101 | ||
102 | /** | ||
103 | * iscsi_sw_sk_state_check - check socket state | ||
104 | * @sk: socket | ||
105 | * | ||
106 | * If the socket is in CLOSE or CLOSE_WAIT we should | ||
107 | * not close the connection if there is still some | ||
108 | * data pending. | ||
109 | */ | ||
110 | static inline int iscsi_sw_sk_state_check(struct sock *sk) | ||
111 | { | ||
112 | struct iscsi_conn *conn = (struct iscsi_conn*)sk->sk_user_data; | ||
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 | } | ||
120 | return 0; | ||
121 | } | ||
122 | |||
102 | static void iscsi_sw_tcp_data_ready(struct sock *sk, int flag) | 123 | static void iscsi_sw_tcp_data_ready(struct sock *sk, int flag) |
103 | { | 124 | { |
104 | struct iscsi_conn *conn = sk->sk_user_data; | 125 | struct iscsi_conn *conn = sk->sk_user_data; |
@@ -117,6 +138,8 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk, int flag) | |||
117 | rd_desc.count = 1; | 138 | rd_desc.count = 1; |
118 | tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); | 139 | tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); |
119 | 140 | ||
141 | iscsi_sw_sk_state_check(sk); | ||
142 | |||
120 | read_unlock(&sk->sk_callback_lock); | 143 | read_unlock(&sk->sk_callback_lock); |
121 | 144 | ||
122 | /* If we had to (atomically) map a highmem page, | 145 | /* If we had to (atomically) map a highmem page, |
@@ -137,13 +160,7 @@ static void iscsi_sw_tcp_state_change(struct sock *sk) | |||
137 | conn = (struct iscsi_conn*)sk->sk_user_data; | 160 | conn = (struct iscsi_conn*)sk->sk_user_data; |
138 | session = conn->session; | 161 | session = conn->session; |
139 | 162 | ||
140 | if ((sk->sk_state == TCP_CLOSE_WAIT || | 163 | iscsi_sw_sk_state_check(sk); |
141 | sk->sk_state == TCP_CLOSE) && | ||
142 | !atomic_read(&sk->sk_rmem_alloc)) { | ||
143 | ISCSI_SW_TCP_DBG(conn, "iscsi_tcp_state_change: " | ||
144 | "TCP_CLOSE|TCP_CLOSE_WAIT\n"); | ||
145 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | ||
146 | } | ||
147 | 164 | ||
148 | tcp_conn = conn->dd_data; | 165 | tcp_conn = conn->dd_data; |
149 | tcp_sw_conn = tcp_conn->dd_data; | 166 | tcp_sw_conn = tcp_conn->dd_data; |