summaryrefslogtreecommitdiffstats
path: root/net/rds/send.c
diff options
context:
space:
mode:
authorTina Yang <Tina.Yang@oracle.com>2010-03-11 14:50:00 +0100
committerDavid S. Miller <davem@davemloft.net>2010-03-17 05:16:55 +0100
commit048c15e641289d902f7ef9f1241068d8045e210c (patch)
treef4e7f27a411b9310c98c41e82285e211abcbfbd7 /net/rds/send.c
parentRDS: Fix congestion issues for loopback (diff)
downloadlinux-048c15e641289d902f7ef9f1241068d8045e210c.tar.xz
linux-048c15e641289d902f7ef9f1241068d8045e210c.zip
RDS: Fix send locking issue
Fix a deadlock between rds_rdma_send_complete() and rds_send_remove_from_sock() when rds socket lock and rds message lock are acquired out-of-order. Signed-off-by: Tina Yang <Tina.Yang@oracle.com> Signed-off-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/send.c')
-rw-r--r--net/rds/send.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/rds/send.c b/net/rds/send.c
index ad2e46947c8a..1a2ef24fbc94 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -533,14 +533,13 @@ void rds_send_remove_from_sock(struct list_head *messages, int status)
if (rs != rm->m_rs) {
if (rs) {
- spin_unlock(&rs->rs_lock);
rds_wake_sk_sleep(rs);
sock_put(rds_rs_to_sk(rs));
}
rs = rm->m_rs;
- spin_lock(&rs->rs_lock);
sock_hold(rds_rs_to_sk(rs));
}
+ spin_lock(&rs->rs_lock);
if (test_and_clear_bit(RDS_MSG_ON_SOCK, &rm->m_flags)) {
struct rds_rdma_op *ro = rm->m_rdma_op;
@@ -560,6 +559,7 @@ void rds_send_remove_from_sock(struct list_head *messages, int status)
rds_message_put(rm);
rm->m_rs = NULL;
}
+ spin_unlock(&rs->rs_lock);
unlock_and_drop:
spin_unlock(&rm->m_rs_lock);
@@ -567,7 +567,6 @@ unlock_and_drop:
}
if (rs) {
- spin_unlock(&rs->rs_lock);
rds_wake_sk_sleep(rs);
sock_put(rds_rs_to_sk(rs));
}