Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * licenses.  You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *     Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *     without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *     conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *      - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *        disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *      - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *        disclaimer in the documentation and/or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *        provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/in.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <net/tcp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include "rds_single_path.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include "rds.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include "tcp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct rds_tcp_connection *tc = cp->cp_transport_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	tcp_sock_set_cork(tc->t_sock->sk, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) void rds_tcp_xmit_path_complete(struct rds_conn_path *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct rds_tcp_connection *tc = cp->cp_transport_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	tcp_sock_set_cork(tc->t_sock->sk, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /* the core send_sem serializes this with other xmit and shutdown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static int rds_tcp_sendmsg(struct socket *sock, void *data, unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct kvec vec = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		.iov_base = data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		.iov_len = len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	struct msghdr msg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	return kernel_sendmsg(sock, &msg, &vec, 1, vec.iov_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /* the core send_sem serializes this with other xmit and shutdown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		 unsigned int hdr_off, unsigned int sg, unsigned int off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	struct rds_conn_path *cp = rm->m_inc.i_conn_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct rds_tcp_connection *tc = cp->cp_transport_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int done = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	int more;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	if (hdr_off == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		 * m_ack_seq is set to the sequence number of the last byte of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		 * header and data.  see rds_tcp_is_acked().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		tc->t_last_sent_nxt = rds_tcp_write_seq(tc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		rm->m_ack_seq = tc->t_last_sent_nxt +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 				sizeof(struct rds_header) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 				be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		smp_mb__before_atomic();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		set_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		tc->t_last_expected_una = rm->m_ack_seq + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		rdsdebug("rm %p tcp nxt %u ack_seq %llu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			 rm, rds_tcp_write_seq(tc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			 (unsigned long long)rm->m_ack_seq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	if (hdr_off < sizeof(struct rds_header)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		/* see rds_tcp_write_space() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		set_bit(SOCK_NOSPACE, &tc->t_sock->sk->sk_socket->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		ret = rds_tcp_sendmsg(tc->t_sock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 				      (void *)&rm->m_inc.i_hdr + hdr_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 				      sizeof(rm->m_inc.i_hdr) - hdr_off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		done += ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		if (hdr_off + done != sizeof(struct rds_header))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	more = rm->data.op_nents > 1 ? (MSG_MORE | MSG_SENDPAGE_NOTLAST) : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	while (sg < rm->data.op_nents) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		int flags = MSG_DONTWAIT | MSG_NOSIGNAL | more;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		ret = tc->t_sock->ops->sendpage(tc->t_sock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 						sg_page(&rm->data.op_sg[sg]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 						rm->data.op_sg[sg].offset + off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 						rm->data.op_sg[sg].length - off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 						flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		rdsdebug("tcp sendpage %p:%u:%u ret %d\n", (void *)sg_page(&rm->data.op_sg[sg]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 			 rm->data.op_sg[sg].offset + off, rm->data.op_sg[sg].length - off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			 ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		if (ret <= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		off += ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		done += ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		if (off == rm->data.op_sg[sg].length) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			off = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			sg++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		if (sg == rm->data.op_nents - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			more = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (ret <= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		/* write_space will hit after EAGAIN, all else fatal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		if (ret == -EAGAIN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			rds_tcp_stats_inc(s_tcp_sndbuf_full);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			/* No need to disconnect/reconnect if path_drop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			 * has already been triggered, because, e.g., of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			 * an incoming RST.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			if (rds_conn_path_up(cp)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				pr_warn("RDS/tcp: send to %pI6c on cp [%d]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 					"returned %d, "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 					"disconnecting and reconnecting\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 					&conn->c_faddr, cp->cp_index, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 				rds_conn_path_drop(cp, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	if (done == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		done = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * rm->m_ack_seq is set to the tcp sequence number that corresponds to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * last byte of the message, including the header.  This means that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  * entire message has been received if rm->m_ack_seq is "before" the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * unacked byte of the TCP sequence space.  We have to do very careful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * wrapping 32bit comparisons here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static int rds_tcp_is_acked(struct rds_message *rm, uint64_t ack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	if (!test_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	return (__s32)((u32)rm->m_ack_seq - (u32)ack) < 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) void rds_tcp_write_space(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	void (*write_space)(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	struct rds_conn_path *cp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	struct rds_tcp_connection *tc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	read_lock_bh(&sk->sk_callback_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	cp = sk->sk_user_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	if (!cp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		write_space = sk->sk_write_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	tc = cp->cp_transport_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	rdsdebug("write_space for tc %p\n", tc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	write_space = tc->t_orig_write_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	rds_tcp_stats_inc(s_tcp_write_space_calls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	rdsdebug("tcp una %u\n", rds_tcp_snd_una(tc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	tc->t_last_seen_una = rds_tcp_snd_una(tc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	rds_send_path_drop_acked(cp, rds_tcp_snd_una(tc), rds_tcp_is_acked);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	    !rds_destroy_pending(cp->cp_conn))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		queue_delayed_work(rds_wq, &cp->cp_send_w, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	read_unlock_bh(&sk->sk_callback_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	 * write_space is only called when data leaves tcp's send queue if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	 * SOCK_NOSPACE is set.  We set SOCK_NOSPACE every time we put
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	 * data in tcp's send queue because we use write_space to parse the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	 * sequence numbers and notice that rds messages have been fully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 * received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	 * tcp's write_space clears SOCK_NOSPACE if the send queue has more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 * than a certain amount of space. So we need to set it again *after*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	 * we call tcp's write_space or else we might only get called on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	 * first of a series of incoming tcp acks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	write_space(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	if (sk->sk_socket)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }