summaryrefslogtreecommitdiff
path: root/net/rds/connection.c
diff options
context:
space:
mode:
authorSowmini Varadhan <sowmini.varadhan@oracle.com>2016-07-01 02:11:12 +0300
committerDavid S. Miller <davem@davemloft.net>2016-07-01 23:45:17 +0300
commit02105b2ccdd6344146e0296172a9e0f17ff624ef (patch)
tree3be5ec1d994b348826c1cd0bf20f85441028fd39 /net/rds/connection.c
parent26e4e6bb683028546f339018ab4cd394300a92a4 (diff)
downloadlinux-02105b2ccdd6344146e0296172a9e0f17ff624ef.tar.xz
RDS: TCP: Make rds_tcp_connection track the rds_conn_path
The struct rds_tcp_connection is the transport-specific private data structure that tracks TCP information per rds_conn_path. Modify this structure to have a back-pointer to the rds_conn_path for which it is the ->cp_transport_data. Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/connection.c')
-rw-r--r--net/rds/connection.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 17c2f2591ac4..1b0c2a783b5e 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -253,9 +253,12 @@ static struct rds_connection *__rds_conn_create(struct net *net,
for (i = 0; i < RDS_MPATH_WORKERS; i++) {
cp = &conn->c_path[i];
- trans->conn_free(cp->cp_transport_data);
- if (!trans->t_mp_capable)
- break;
+ /* The ->conn_alloc invocation may have
+ * allocated resource for all paths, so all
+ * of them may have to be freed here.
+ */
+ if (cp->cp_transport_data)
+ trans->conn_free(cp->cp_transport_data);
}
kmem_cache_free(rds_conn_slab, conn);
conn = found;
@@ -367,6 +370,9 @@ static void rds_conn_path_destroy(struct rds_conn_path *cp)
{
struct rds_message *rm, *rtmp;
+ if (!cp->cp_transport_data)
+ return;
+
rds_conn_path_drop(cp);
flush_work(&cp->cp_down_w);
@@ -398,6 +404,8 @@ static void rds_conn_path_destroy(struct rds_conn_path *cp)
void rds_conn_destroy(struct rds_connection *conn)
{
unsigned long flags;
+ int i;
+ struct rds_conn_path *cp;
rdsdebug("freeing conn %p for %pI4 -> "
"%pI4\n", conn, &conn->c_laddr,
@@ -410,18 +418,10 @@ void rds_conn_destroy(struct rds_connection *conn)
synchronize_rcu();
/* shut the connection down */
- if (!conn->c_trans->t_mp_capable) {
- rds_conn_path_destroy(&conn->c_path[0]);
- BUG_ON(!list_empty(&conn->c_path[0].cp_retrans));
- } else {
- int i;
- struct rds_conn_path *cp;
-
- for (i = 0; i < RDS_MPATH_WORKERS; i++) {
- cp = &conn->c_path[i];
- rds_conn_path_destroy(cp);
- BUG_ON(!list_empty(&cp->cp_retrans));
- }
+ for (i = 0; i < RDS_MPATH_WORKERS; i++) {
+ cp = &conn->c_path[i];
+ rds_conn_path_destroy(cp);
+ BUG_ON(!list_empty(&cp->cp_retrans));
}
/*