sendmsg.c (96b4059f43ce69e9c590f77d6ce3e99888d5cfe6) sendmsg.c (9d35d880e0e4a3ab32d8c12f9e4d76198aadd42d)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* AF_RXRPC sendmsg() implementation.
3 *
4 * Copyright (C) 2007, 2016 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 25 unchanged lines hidden (view full) ---

34 rxrpc_poke_call(call, rxrpc_call_poke_abort);
35 return true;
36 }
37
38 return false;
39}
40
41/*
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* AF_RXRPC sendmsg() implementation.
3 *
4 * Copyright (C) 2007, 2016 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 25 unchanged lines hidden (view full) ---

34 rxrpc_poke_call(call, rxrpc_call_poke_abort);
35 return true;
36 }
37
38 return false;
39}
40
41/*
42 * Wait for a call to become connected. Interruption here doesn't cause the
43 * call to be aborted.
44 */
45static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo)
46{
47 DECLARE_WAITQUEUE(myself, current);
48 int ret = 0;
49
50 _enter("%d", call->debug_id);
51
52 if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN)
53 return call->error;
54
55 add_wait_queue_exclusive(&call->waitq, &myself);
56
57 for (;;) {
58 ret = call->error;
59 if (ret < 0)
60 break;
61
62 switch (call->interruptibility) {
63 case RXRPC_INTERRUPTIBLE:
64 case RXRPC_PREINTERRUPTIBLE:
65 set_current_state(TASK_INTERRUPTIBLE);
66 break;
67 case RXRPC_UNINTERRUPTIBLE:
68 default:
69 set_current_state(TASK_UNINTERRUPTIBLE);
70 break;
71 }
72 if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN) {
73 ret = call->error;
74 break;
75 }
76 if ((call->interruptibility == RXRPC_INTERRUPTIBLE ||
77 call->interruptibility == RXRPC_PREINTERRUPTIBLE) &&
78 signal_pending(current)) {
79 ret = sock_intr_errno(*timeo);
80 break;
81 }
82 *timeo = schedule_timeout(*timeo);
83 }
84
85 remove_wait_queue(&call->waitq, &myself);
86 __set_current_state(TASK_RUNNING);
87
88 if (ret == 0 && rxrpc_call_is_complete(call))
89 ret = call->error;
90
91 _leave(" = %d", ret);
92 return ret;
93}
94
95/*
42 * Return true if there's sufficient Tx queue space.
43 */
44static bool rxrpc_check_tx_space(struct rxrpc_call *call, rxrpc_seq_t *_tx_win)
45{
46 if (_tx_win)
47 *_tx_win = call->tx_bottom;
48 return call->tx_prepared - call->tx_bottom < 256;
49}

--- 184 unchanged lines hidden (view full) ---

234 struct sock *sk = &rx->sk;
235 enum rxrpc_call_state state;
236 long timeo;
237 bool more = msg->msg_flags & MSG_MORE;
238 int ret, copied = 0;
239
240 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
241
96 * Return true if there's sufficient Tx queue space.
97 */
98static bool rxrpc_check_tx_space(struct rxrpc_call *call, rxrpc_seq_t *_tx_win)
99{
100 if (_tx_win)
101 *_tx_win = call->tx_bottom;
102 return call->tx_prepared - call->tx_bottom < 256;
103}

--- 184 unchanged lines hidden (view full) ---

288 struct sock *sk = &rx->sk;
289 enum rxrpc_call_state state;
290 long timeo;
291 bool more = msg->msg_flags & MSG_MORE;
292 int ret, copied = 0;
293
294 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
295
296 ret = rxrpc_wait_to_be_connected(call, &timeo);
297 if (ret < 0)
298 return ret;
299
300 if (call->conn->state == RXRPC_CONN_CLIENT_UNSECURED) {
301 ret = rxrpc_init_client_conn_security(call->conn);
302 if (ret < 0)
303 return ret;
304 }
305
242 /* this should be in poll */
243 sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
244
245reload:
246 ret = -EPIPE;
247 if (sk->sk_shutdown & SEND_SHUTDOWN)
248 goto maybe_error;
249 state = rxrpc_call_state(call);

--- 511 unchanged lines hidden ---
306 /* this should be in poll */
307 sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
308
309reload:
310 ret = -EPIPE;
311 if (sk->sk_shutdown & SEND_SHUTDOWN)
312 goto maybe_error;
313 state = rxrpc_call_state(call);

--- 511 unchanged lines hidden ---