aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/connection.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-05-11 18:11:11 -0400
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:15:09 -0400
commit7e3f2952eeb1a0fe2aa9882fd1705a88f9d89b35 (patch)
tree903d89d0d1184bd1f33df2b5036615d1c40cfb06 /net/rds/connection.c
parent38a4e5e61344490f18241333d7b1b368a3a38748 (diff)
rds: don't let RDS shutdown a connection while senders are present
This is the first in a long line of patches that tries to fix races between RDS connection shutdown and RDS traffic. Here we are maintaining a count of active senders to make sure the connection doesn't go away while they are using it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'net/rds/connection.c')
-rw-r--r--net/rds/connection.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 7e4e9dfdbc0b..9c249f394f29 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -148,6 +148,7 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
148 148
149 spin_lock_init(&conn->c_send_lock); 149 spin_lock_init(&conn->c_send_lock);
150 atomic_set(&conn->c_send_generation, 1); 150 atomic_set(&conn->c_send_generation, 1);
151 atomic_set(&conn->c_senders, 0);
151 INIT_LIST_HEAD(&conn->c_send_queue); 152 INIT_LIST_HEAD(&conn->c_send_queue);
152 INIT_LIST_HEAD(&conn->c_retrans); 153 INIT_LIST_HEAD(&conn->c_retrans);
153 154
@@ -276,6 +277,12 @@ void rds_conn_shutdown(struct rds_connection *conn)
276 spin_lock_irq(&conn->c_send_lock); 277 spin_lock_irq(&conn->c_send_lock);
277 spin_unlock_irq(&conn->c_send_lock); 278 spin_unlock_irq(&conn->c_send_lock);
278 279
280 while(atomic_read(&conn->c_senders)) {
281 schedule_timeout(1);
282 spin_lock_irq(&conn->c_send_lock);
283 spin_unlock_irq(&conn->c_send_lock);
284 }
285
279 conn->c_trans->conn_shutdown(conn); 286 conn->c_trans->conn_shutdown(conn);
280 rds_conn_reset(conn); 287 rds_conn_reset(conn);
281 288