RDS: TCP: bug fixes
Subsystems (3)
cover RDS: TCP: bug fixes
A couple of bug fixes identified during testing.
Sowmini Varadhan (2):
RDS: TCP: report addr/port info based on TCP socket in rds-info
RDS: TCP: start multipath acceptor loop at 0
net/rds/tcp.c | 20 +++++++++++++------- net/rds/tcp_listen.c | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-)
PATCH 1/2 RDS: TCP: report addr/port info based on TCP socket in rds-info
The socket argument passed to rds_tcp_tc_info() is a PF_RDS socket, so it is incorrect to report the address port info based on rds_getname() as part of TCP state report.
Invoke inet_getname() for the t_sock associated with the rds_tcp_connection instead.
--- net/rds/tcp.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)
net/rds/tcp.c +13 -7
@@ -220,7 +220,7 @@ void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp)write_unlock_bh (&sock->sk->sk_callback_lock); } -static void rds_tcp_tc_info (struct socket *sock,unsigned int len, +static void rds_tcp_tc_info (struct socket *rds_sock,unsigned int len,struct rds_info_iterator *iter,struct rds_info_lengths *lens) {
@@ -229,6 +229,7 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len,unsigned long flags;struct sockaddr_in sin;int sinlen; +struct socket *sock;spin_lock_irqsave (&rds_tcp_tc_list_lock, flags);
@@ -237,12 +238,17 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len,list_for_each_entry (tc, &rds_tcp_tc_list, t_list_item) { - sock->ops->getname (sock, (struct sockaddr *)&sin, &sinlen,0 ); - tsinfo.local_addr = sin.sin_addr.s_addr; - tsinfo.local_port = sin.sin_port; - sock->ops->getname (sock, (struct sockaddr *)&sin, &sinlen,1 ); - tsinfo.peer_addr = sin.sin_addr.s_addr; - tsinfo.peer_port = sin.sin_port; + sock = tc->t_sock; +if (sock) { + sock->ops->getname (sock, (struct sockaddr *)&sin, + &sinlen,0 ); + tsinfo.local_addr = sin.sin_addr.s_addr; + tsinfo.local_port = sin.sin_port; + sock->ops->getname (sock, (struct sockaddr *)&sin, + &sinlen,1 ); + tsinfo.peer_addr = sin.sin_addr.s_addr; + tsinfo.peer_port = sin.sin_port; + } tsinfo.hdr_rem = tc->t_tinc_hdr_rem; tsinfo.data_rem = tc->t_tinc_data_rem;
Signature · 1 line
1.7.1
PATCH 2/2 RDS: TCP: start multipath acceptor loop at 0
In reply to Sowmini VaradhanThe for() loop in rds_tcp_accept_one() assumes that the 0'th rds_tcp_conn_path is UP and starts multipath accepts at index 1. But this assumption may not always be true: if the 0'th path has failed (ERROR or DOWN state) an incoming connection request should be used to resurrect this path.
--- net/rds/tcp_listen.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/rds/tcp_listen.c +1 -1
@@ -103,7 +103,7 @@ struct rds_tcp_connection *rds_tcp_accept_one_path(struct rds_connection *conn)if (!peer_is_smaller)return NULL ; -for (i =1 ; i < npaths; i++) { +for (i =0 ; i < npaths; i++) {struct rds_conn_path *cp = &conn->c_path[i]; if (rds_conn_path_transition(cp, RDS_CONN_DOWN,
Signature · 1 line
1.7.1
David Miller
maintainerFrom: Sowmini Varadhan <[email protected]>
Date: Fri, 4 Nov 2016 10:04:10 -0700
Quoted 1 line
A couple of bug fixes identified during testing.
Series applied, thanks.