diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-09-16 19:03:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-09-16 19:03:28 -0400 |
commit | 559cf710b07c5e2cfa3fb8d8f4a1320fd84c53f9 (patch) | |
tree | deb74aea811a7d7c7e203f3743fd15372f8a6589 /net/sctp/associola.c | |
parent | 293035479942400a7fe8e4f72465d4e4e466b91a (diff) |
[SCTP]: Convert bind_addr_list locking to RCU
Since the sctp_sockaddr_entry is now RCU enabled as part of
the patch to synchronize sctp_localaddr_list, it makes sense to
change all handling of these entries to RCU. This includes the
sctp_bind_addrs structure and it's list of bound addresses.
This list is currently protected by an external rw_lock and that
looks like an overkill. There are only 2 writers to the list:
bind()/bindx() calls, and BH processing of ASCONF-ACK chunks.
These are already seriealized via the socket lock, so they will
not step on each other. These are also relatively rare, so we
should be good with RCU.
The readers are varied and they are easily converted to RCU.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Sridhar Samdurala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 2ad1caf1ea42..9bad8ba0feda 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -99,7 +99,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
99 | 99 | ||
100 | /* Initialize the bind addr area. */ | 100 | /* Initialize the bind addr area. */ |
101 | sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port); | 101 | sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port); |
102 | rwlock_init(&asoc->base.addr_lock); | ||
103 | 102 | ||
104 | asoc->state = SCTP_STATE_CLOSED; | 103 | asoc->state = SCTP_STATE_CLOSED; |
105 | 104 | ||
@@ -937,8 +936,6 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, | |||
937 | { | 936 | { |
938 | struct sctp_transport *transport; | 937 | struct sctp_transport *transport; |
939 | 938 | ||
940 | sctp_read_lock(&asoc->base.addr_lock); | ||
941 | |||
942 | if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && | 939 | if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && |
943 | (htons(asoc->peer.port) == paddr->v4.sin_port)) { | 940 | (htons(asoc->peer.port) == paddr->v4.sin_port)) { |
944 | transport = sctp_assoc_lookup_paddr(asoc, paddr); | 941 | transport = sctp_assoc_lookup_paddr(asoc, paddr); |
@@ -952,7 +949,6 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, | |||
952 | transport = NULL; | 949 | transport = NULL; |
953 | 950 | ||
954 | out: | 951 | out: |
955 | sctp_read_unlock(&asoc->base.addr_lock); | ||
956 | return transport; | 952 | return transport; |
957 | } | 953 | } |
958 | 954 | ||
@@ -1376,19 +1372,13 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, | |||
1376 | int sctp_assoc_lookup_laddr(struct sctp_association *asoc, | 1372 | int sctp_assoc_lookup_laddr(struct sctp_association *asoc, |
1377 | const union sctp_addr *laddr) | 1373 | const union sctp_addr *laddr) |
1378 | { | 1374 | { |
1379 | int found; | 1375 | int found = 0; |
1380 | 1376 | ||
1381 | sctp_read_lock(&asoc->base.addr_lock); | ||
1382 | if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && | 1377 | if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && |
1383 | sctp_bind_addr_match(&asoc->base.bind_addr, laddr, | 1378 | sctp_bind_addr_match(&asoc->base.bind_addr, laddr, |
1384 | sctp_sk(asoc->base.sk))) { | 1379 | sctp_sk(asoc->base.sk))) |
1385 | found = 1; | 1380 | found = 1; |
1386 | goto out; | ||
1387 | } | ||
1388 | 1381 | ||
1389 | found = 0; | ||
1390 | out: | ||
1391 | sctp_read_unlock(&asoc->base.addr_lock); | ||
1392 | return found; | 1382 | return found; |
1393 | } | 1383 | } |
1394 | 1384 | ||