| .. | .. |
|---|
| 129 | 129 | sock_put(sk); |
|---|
| 130 | 130 | } |
|---|
| 131 | 131 | |
|---|
| 132 | | -static int smc_rx_pipe_buf_nosteal(struct pipe_inode_info *pipe, |
|---|
| 133 | | - struct pipe_buffer *buf) |
|---|
| 134 | | -{ |
|---|
| 135 | | - return 1; |
|---|
| 136 | | -} |
|---|
| 137 | | - |
|---|
| 138 | 132 | static const struct pipe_buf_operations smc_pipe_ops = { |
|---|
| 139 | | - .can_merge = 0, |
|---|
| 140 | | - .confirm = generic_pipe_buf_confirm, |
|---|
| 141 | 133 | .release = smc_rx_pipe_buf_release, |
|---|
| 142 | | - .steal = smc_rx_pipe_buf_nosteal, |
|---|
| 143 | 134 | .get = generic_pipe_buf_get |
|---|
| 144 | 135 | }; |
|---|
| 145 | 136 | |
|---|
| .. | .. |
|---|
| 202 | 193 | { |
|---|
| 203 | 194 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
|---|
| 204 | 195 | struct smc_connection *conn = &smc->conn; |
|---|
| 196 | + struct smc_cdc_conn_state_flags *cflags = |
|---|
| 197 | + &conn->local_tx_ctrl.conn_state_flags; |
|---|
| 205 | 198 | struct sock *sk = &smc->sk; |
|---|
| 206 | 199 | int rc; |
|---|
| 207 | 200 | |
|---|
| .. | .. |
|---|
| 210 | 203 | sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
|---|
| 211 | 204 | add_wait_queue(sk_sleep(sk), &wait); |
|---|
| 212 | 205 | rc = sk_wait_event(sk, timeo, |
|---|
| 213 | | - sk->sk_err || |
|---|
| 214 | | - sk->sk_shutdown & RCV_SHUTDOWN || |
|---|
| 206 | + READ_ONCE(sk->sk_err) || |
|---|
| 207 | + cflags->peer_conn_abort || |
|---|
| 208 | + READ_ONCE(sk->sk_shutdown) & RCV_SHUTDOWN || |
|---|
| 209 | + conn->killed || |
|---|
| 215 | 210 | fcrit(conn), |
|---|
| 216 | 211 | &wait); |
|---|
| 217 | 212 | remove_wait_queue(sk_sleep(sk), &wait); |
|---|
| .. | .. |
|---|
| 315 | 310 | if (read_done >= target || (pipe && read_done)) |
|---|
| 316 | 311 | break; |
|---|
| 317 | 312 | |
|---|
| 313 | + if (conn->killed) |
|---|
| 314 | + break; |
|---|
| 315 | + |
|---|
| 318 | 316 | if (smc_rx_recvmsg_data_available(smc)) |
|---|
| 319 | 317 | goto copy; |
|---|
| 320 | 318 | |
|---|
| 321 | | - if (sk->sk_shutdown & RCV_SHUTDOWN || |
|---|
| 322 | | - conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { |
|---|
| 319 | + if (sk->sk_shutdown & RCV_SHUTDOWN) { |
|---|
| 323 | 320 | /* smc_cdc_msg_recv_action() could have run after |
|---|
| 324 | 321 | * above smc_rx_recvmsg_data_available() |
|---|
| 325 | 322 | */ |
|---|
| .. | .. |
|---|
| 349 | 346 | } |
|---|
| 350 | 347 | break; |
|---|
| 351 | 348 | } |
|---|
| 349 | + if (!timeo) |
|---|
| 350 | + return -EAGAIN; |
|---|
| 352 | 351 | if (signal_pending(current)) { |
|---|
| 353 | 352 | read_done = sock_intr_errno(timeo); |
|---|
| 354 | 353 | break; |
|---|
| 355 | 354 | } |
|---|
| 356 | | - if (!timeo) |
|---|
| 357 | | - return -EAGAIN; |
|---|
| 358 | 355 | } |
|---|
| 359 | 356 | |
|---|
| 360 | 357 | if (!smc_rx_data_available(conn)) { |
|---|