[PATCH 1/9] RDS: Fix m_rs_lock deadlock

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andy Grover
Date: Monday, March 30, 2009 - 11:44 am

rs_send_drop_to() is called during socket close. If it takes
m_rs_lock without disabling interrupts, then
rds_send_remove_from_sock() can run from the rx completion
handler and thus deadlock.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
---
 net/rds/send.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/rds/send.c b/net/rds/send.c
index 1b37364..104fe03 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -615,7 +615,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
 {
 	struct rds_message *rm, *tmp;
 	struct rds_connection *conn;
-	unsigned long flags;
+	unsigned long flags, flags2;
 	LIST_HEAD(list);
 	int wake = 0;
 
@@ -651,9 +651,9 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
 	list_for_each_entry(rm, &list, m_sock_item) {
 		/* We do this here rather than in the loop above, so that
 		 * we don't have to nest m_rs_lock under rs->rs_lock */
-		spin_lock(&rm->m_rs_lock);
+		spin_lock_irqsave(&rm->m_rs_lock, flags2);
 		rm->m_rs = NULL;
-		spin_unlock(&rm->m_rs_lock);
+		spin_unlock_irqrestore(&rm->m_rs_lock, flags2);
 
 		/*
 		 * If we see this flag cleared then we're *sure* that someone
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/9] RDS updates, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 1/9] RDS: Fix m_rs_lock deadlock, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 6/9] RDS: Fix ordering in a conditional, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 8/9] RDS: Rewrite connection cleanup, Andy Grover, (Mon Mar 30, 11:44 am)
[PATCH 9/9] RDS: use get_user_pages_fast(), Andy Grover, (Mon Mar 30, 11:44 am)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, Roland Dreier, (Mon Mar 30, 9:27 pm)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, Andrew Grover, (Mon Mar 30, 11:56 pm)
Re: [PATCH 6/9] RDS: Fix ordering in a conditional, David Miller, (Tue Mar 31, 2:50 pm)