aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorZach Brown <zach.brown@oracle.com>2010-05-24 16:14:36 -0400
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:15:18 -0400
commitf3c6808d3d8513db2b0543538fc35c25a60fe7a7 (patch)
tree84ef99e9d615351000c5cfa81cc08c8c8ffb4be6 /net/rds
parent3e0249f9c05cb77b66f7f09644ca9ca208d991a9 (diff)
RDS: introduce rds_conn_connect_if_down()
A few paths had the same block of code to queue a connection's connect work if it was in the right state. Let's move this in to a helper function. Signed-off-by: Zach Brown <zach.brown@oracle.com>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/connection.c12
-rw-r--r--net/rds/rds.h1
-rw-r--r--net/rds/send.c16
3 files changed, 15 insertions, 14 deletions
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 180b83ab2607..5bd96d538fb9 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -540,6 +540,18 @@ void rds_conn_drop(struct rds_connection *conn)
540EXPORT_SYMBOL_GPL(rds_conn_drop); 540EXPORT_SYMBOL_GPL(rds_conn_drop);
541 541
542/* 542/*
543 * If the connection is down, trigger a connect. We may have scheduled a
544 * delayed reconnect however - in this case we should not interfere.
545 */
546void rds_conn_connect_if_down(struct rds_connection *conn)
547{
548 if (rds_conn_state(conn) == RDS_CONN_DOWN &&
549 !test_and_set_bit(RDS_RECONNECT_PENDING, &conn->c_flags))
550 queue_delayed_work(rds_wq, &conn->c_conn_w, 0);
551}
552EXPORT_SYMBOL_GPL(rds_conn_connect_if_down);
553
554/*
543 * An error occurred on the connection 555 * An error occurred on the connection
544 */ 556 */
545void 557void
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 4ab3d1aa0237..cba5f8bb4780 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -617,6 +617,7 @@ void rds_conn_shutdown(struct rds_connection *conn);
617void rds_conn_destroy(struct rds_connection *conn); 617void rds_conn_destroy(struct rds_connection *conn);
618void rds_conn_reset(struct rds_connection *conn); 618void rds_conn_reset(struct rds_connection *conn);
619void rds_conn_drop(struct rds_connection *conn); 619void rds_conn_drop(struct rds_connection *conn);
620void rds_conn_connect_if_down(struct rds_connection *conn);
620void rds_for_each_conn_info(struct socket *sock, unsigned int len, 621void rds_for_each_conn_info(struct socket *sock, unsigned int len,
621 struct rds_info_iterator *iter, 622 struct rds_info_iterator *iter,
622 struct rds_info_lengths *lens, 623 struct rds_info_lengths *lens,
diff --git a/net/rds/send.c b/net/rds/send.c
index 437f1e72609c..a6295993e3e1 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -1036,13 +1036,7 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
1036 goto out; 1036 goto out;
1037 } 1037 }
1038 1038
1039 /* If the connection is down, trigger a connect. We may 1039 rds_conn_connect_if_down(conn);
1040 * have scheduled a delayed reconnect however - in this case
1041 * we should not interfere.
1042 */
1043 if (rds_conn_state(conn) == RDS_CONN_DOWN &&
1044 !test_and_set_bit(RDS_RECONNECT_PENDING, &conn->c_flags))
1045 queue_delayed_work(rds_wq, &conn->c_conn_w, 0);
1046 1040
1047 ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs); 1041 ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs);
1048 if (ret) { 1042 if (ret) {
@@ -1122,13 +1116,7 @@ rds_send_pong(struct rds_connection *conn, __be16 dport)
1122 rm->m_daddr = conn->c_faddr; 1116 rm->m_daddr = conn->c_faddr;
1123 rm->data.op_active = 1; 1117 rm->data.op_active = 1;
1124 1118
1125 /* If the connection is down, trigger a connect. We may 1119 rds_conn_connect_if_down(conn);
1126 * have scheduled a delayed reconnect however - in this case
1127 * we should not interfere.
1128 */
1129 if (rds_conn_state(conn) == RDS_CONN_DOWN &&
1130 !test_and_set_bit(RDS_RECONNECT_PENDING, &conn->c_flags))
1131 queue_delayed_work(rds_wq, &conn->c_conn_w, 0);
1132 1120
1133 ret = rds_cong_wait(conn->c_fcong, dport, 1, NULL); 1121 ret = rds_cong_wait(conn->c_fcong, dport, 1, NULL);
1134 if (ret) 1122 if (ret)