sendmsg.c (2c55d703391acf7e9101da596d0c15ee03b318a3) | sendmsg.c (a343b174b4bdde851033996960bca5ad1394d04b) |
---|---|
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 --- 4 unchanged lines hidden (view full) --- 13#include <linux/export.h> 14#include <linux/sched/signal.h> 15 16#include <net/sock.h> 17#include <net/af_rxrpc.h> 18#include "ar-internal.h" 19 20/* | 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 --- 4 unchanged lines hidden (view full) --- 13#include <linux/export.h> 14#include <linux/sched/signal.h> 15 16#include <net/sock.h> 17#include <net/af_rxrpc.h> 18#include "ar-internal.h" 19 20/* |
21 * Propose an abort to be made in the I/O thread. 22 */ 23bool rxrpc_propose_abort(struct rxrpc_call *call, 24 u32 abort_code, int error, const char *why) 25{ 26 _enter("{%d},%d,%d,%s", call->debug_id, abort_code, error, why); 27 28 if (!call->send_abort && call->state < RXRPC_CALL_COMPLETE) { 29 call->send_abort_why = why; 30 call->send_abort_err = error; 31 /* Request abort locklessly vs rxrpc_input_call_event(). */ 32 smp_store_release(&call->send_abort, abort_code); 33 rxrpc_poke_call(call, rxrpc_call_poke_abort); 34 return true; 35 } 36 37 return false; 38} 39 40/* |
|
21 * Return true if there's sufficient Tx queue space. 22 */ 23static bool rxrpc_check_tx_space(struct rxrpc_call *call, rxrpc_seq_t *_tx_win) 24{ 25 if (_tx_win) 26 *_tx_win = call->tx_bottom; 27 return call->tx_prepared - call->tx_bottom < 256; 28} --- 629 unchanged lines hidden (view full) --- 658 state = READ_ONCE(call->state); 659 _debug("CALL %d USR %lx ST %d on CONN %p", 660 call->debug_id, call->user_call_ID, state, call->conn); 661 662 if (state >= RXRPC_CALL_COMPLETE) { 663 /* it's too late for this call */ 664 ret = -ESHUTDOWN; 665 } else if (p.command == RXRPC_CMD_SEND_ABORT) { | 41 * Return true if there's sufficient Tx queue space. 42 */ 43static bool rxrpc_check_tx_space(struct rxrpc_call *call, rxrpc_seq_t *_tx_win) 44{ 45 if (_tx_win) 46 *_tx_win = call->tx_bottom; 47 return call->tx_prepared - call->tx_bottom < 256; 48} --- 629 unchanged lines hidden (view full) --- 678 state = READ_ONCE(call->state); 679 _debug("CALL %d USR %lx ST %d on CONN %p", 680 call->debug_id, call->user_call_ID, state, call->conn); 681 682 if (state >= RXRPC_CALL_COMPLETE) { 683 /* it's too late for this call */ 684 ret = -ESHUTDOWN; 685 } else if (p.command == RXRPC_CMD_SEND_ABORT) { |
686 rxrpc_propose_abort(call, p.abort_code, -ECONNABORTED, "CMD"); |
|
666 ret = 0; | 687 ret = 0; |
667 if (rxrpc_abort_call("CMD", call, 0, p.abort_code, -ECONNABORTED)) 668 ret = rxrpc_send_abort_packet(call); | |
669 } else if (p.command != RXRPC_CMD_SEND_DATA) { 670 ret = -EINVAL; 671 } else { 672 ret = rxrpc_send_data(rx, call, msg, len, NULL, &dropped_lock); 673 } 674 675out_put_unlock: 676 if (!dropped_lock) --- 78 unchanged lines hidden (view full) --- 755bool rxrpc_kernel_abort_call(struct socket *sock, struct rxrpc_call *call, 756 u32 abort_code, int error, const char *why) 757{ 758 bool aborted; 759 760 _enter("{%d},%d,%d,%s", call->debug_id, abort_code, error, why); 761 762 mutex_lock(&call->user_mutex); | 688 } else if (p.command != RXRPC_CMD_SEND_DATA) { 689 ret = -EINVAL; 690 } else { 691 ret = rxrpc_send_data(rx, call, msg, len, NULL, &dropped_lock); 692 } 693 694out_put_unlock: 695 if (!dropped_lock) --- 78 unchanged lines hidden (view full) --- 774bool rxrpc_kernel_abort_call(struct socket *sock, struct rxrpc_call *call, 775 u32 abort_code, int error, const char *why) 776{ 777 bool aborted; 778 779 _enter("{%d},%d,%d,%s", call->debug_id, abort_code, error, why); 780 781 mutex_lock(&call->user_mutex); |
763 764 aborted = rxrpc_abort_call(why, call, 0, abort_code, error); 765 if (aborted) 766 rxrpc_send_abort_packet(call); 767 | 782 aborted = rxrpc_propose_abort(call, abort_code, error, why); |
768 mutex_unlock(&call->user_mutex); 769 return aborted; 770} 771EXPORT_SYMBOL(rxrpc_kernel_abort_call); 772 773/** 774 * rxrpc_kernel_set_tx_length - Set the total Tx length on a call 775 * @sock: The socket the call is on --- 16 unchanged lines hidden --- | 783 mutex_unlock(&call->user_mutex); 784 return aborted; 785} 786EXPORT_SYMBOL(rxrpc_kernel_abort_call); 787 788/** 789 * rxrpc_kernel_set_tx_length - Set the total Tx length on a call 790 * @sock: The socket the call is on --- 16 unchanged lines hidden --- |