Skip to content

Commit

Permalink
rds: If one path needs re-connection, check all and re-connect
Browse files Browse the repository at this point in the history
In testing with mprds enabled, Oracle Cluster nodes after reboot were
not able to communicate with others nodes and so failed to rejoin
the cluster. Peers with lower IP address initiated connection but the
node could not respond as it choose a different path and could not
initiate a connection as it had a higher IP address.

With this patch, when a node sends out a packet and the selected path
is down, all other paths are also checked and any down paths are
re-connected.

Reviewed-by: Ka-cheong Poon <ka-cheong.poon@oracle.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Signed-off-by: Rao Shoaib <rao.shoaib@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rao Shoaib authored and davem330 committed Jul 2, 2020
1 parent e6ced83 commit 9ef845f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions net/rds/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,17 @@ void rds_conn_path_connect_if_down(struct rds_conn_path *cp)
}
EXPORT_SYMBOL_GPL(rds_conn_path_connect_if_down);

/* Check connectivity of all paths
*/
void rds_check_all_paths(struct rds_connection *conn)
{
int i = 0;

do {
rds_conn_path_connect_if_down(&conn->c_path[i]);
} while (++i < conn->c_npaths);
}

void rds_conn_connect_if_down(struct rds_connection *conn)
{
WARN_ON(conn->c_trans->t_mp_capable);
Expand Down
7 changes: 7 additions & 0 deletions net/rds/rds.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ void rds_conn_drop(struct rds_connection *conn);
void rds_conn_path_drop(struct rds_conn_path *cpath, bool destroy);
void rds_conn_connect_if_down(struct rds_connection *conn);
void rds_conn_path_connect_if_down(struct rds_conn_path *cp);
void rds_check_all_paths(struct rds_connection *conn);
void rds_for_each_conn_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens,
Expand Down Expand Up @@ -822,6 +823,12 @@ rds_conn_path_up(struct rds_conn_path *cp)
return atomic_read(&cp->cp_state) == RDS_CONN_UP;
}

static inline int
rds_conn_path_down(struct rds_conn_path *cp)
{
return atomic_read(&cp->cp_state) == RDS_CONN_DOWN;
}

static inline int
rds_conn_up(struct rds_connection *conn)
{
Expand Down
3 changes: 2 additions & 1 deletion net/rds/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,8 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
goto out;
}

rds_conn_path_connect_if_down(cpath);
if (rds_conn_path_down(cpath))
rds_check_all_paths(conn);

ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
if (ret) {
Expand Down

0 comments on commit 9ef845f

Please sign in to comment.