[PATCH rdma-core 3/5] rsockets: Add locks around CM state processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In rs_do_connect(), we drive the connection state of an rsocket.
Because applications may call rpoll() from multiple thread, it's
possible for multiple threads to try driving the rsocket connection
state.  Use the rsocket slock to serialize their access.

Signed-off-by: Sean Hefty <sean.hefty@xxxxxxxxx>
---
 librdmacm/rsocket.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/librdmacm/rsocket.c b/librdmacm/rsocket.c
index cee3bd01..9ac881bc 100644
--- a/librdmacm/rsocket.c
+++ b/librdmacm/rsocket.c
@@ -1327,6 +1327,7 @@ static int rs_do_connect(struct rsocket *rs)
 	struct rs_conn_data *creq, *cresp;
 	int to, ret;
 
+	fastlock_acquire(&rs->slock);
 	switch (rs->state) {
 	case rs_init:
 	case rs_bound:
@@ -1437,6 +1438,7 @@ connected:
 			rs->err = errno;
 		}
 	}
+	fastlock_release(&rs->slock);
 	return ret;
 }
 





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux