aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2008-05-12 11:04:51 -0400
committerDavid Teigland <teigland@redhat.com>2008-05-19 16:37:27 -0400
commit7a936ce71eed7b887b8a0d6c54dd8a9072f71c9f (patch)
tree9d4d691a54a584e6991e8dfb9a9551536b0cb787 /fs/dlm
parent860da5e578c25d1ab4528c0d1ad13f9969e3490f (diff)
dlm: convert connections_lock in a mutex
The semaphore connections_lock is used as a mutex. Convert it to the mutex API. Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net> Cc: Christine Caulfield <ccaulfie@redhat.com> Cc: David Teigland <teigland@redhat.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lowcomms.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 7c1e5e5cccd8..c7d232a9ae12 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -50,6 +50,7 @@
50#include <linux/pagemap.h> 50#include <linux/pagemap.h>
51#include <linux/idr.h> 51#include <linux/idr.h>
52#include <linux/file.h> 52#include <linux/file.h>
53#include <linux/mutex.h>
53#include <linux/sctp.h> 54#include <linux/sctp.h>
54#include <net/sctp/user.h> 55#include <net/sctp/user.h>
55 56
@@ -138,7 +139,7 @@ static struct workqueue_struct *recv_workqueue;
138static struct workqueue_struct *send_workqueue; 139static struct workqueue_struct *send_workqueue;
139 140
140static DEFINE_IDR(connections_idr); 141static DEFINE_IDR(connections_idr);
141static DECLARE_MUTEX(connections_lock); 142static DEFINE_MUTEX(connections_lock);
142static int max_nodeid; 143static int max_nodeid;
143static struct kmem_cache *con_cache; 144static struct kmem_cache *con_cache;
144 145
@@ -205,9 +206,9 @@ static struct connection *nodeid2con(int nodeid, gfp_t allocation)
205{ 206{
206 struct connection *con; 207 struct connection *con;
207 208
208 down(&connections_lock); 209 mutex_lock(&connections_lock);
209 con = __nodeid2con(nodeid, allocation); 210 con = __nodeid2con(nodeid, allocation);
210 up(&connections_lock); 211 mutex_unlock(&connections_lock);
211 212
212 return con; 213 return con;
213} 214}
@@ -218,15 +219,15 @@ static struct connection *assoc2con(int assoc_id)
218 int i; 219 int i;
219 struct connection *con; 220 struct connection *con;
220 221
221 down(&connections_lock); 222 mutex_lock(&connections_lock);
222 for (i=0; i<=max_nodeid; i++) { 223 for (i=0; i<=max_nodeid; i++) {
223 con = __nodeid2con(i, 0); 224 con = __nodeid2con(i, 0);
224 if (con && con->sctp_assoc == assoc_id) { 225 if (con && con->sctp_assoc == assoc_id) {
225 up(&connections_lock); 226 mutex_unlock(&connections_lock);
226 return con; 227 return con;
227 } 228 }
228 } 229 }
229 up(&connections_lock); 230 mutex_unlock(&connections_lock);
230 return NULL; 231 return NULL;
231} 232}
232 233
@@ -381,7 +382,7 @@ static void sctp_init_failed(void)
381 int i; 382 int i;
382 struct connection *con; 383 struct connection *con;
383 384
384 down(&connections_lock); 385 mutex_lock(&connections_lock);
385 for (i=1; i<=max_nodeid; i++) { 386 for (i=1; i<=max_nodeid; i++) {
386 con = __nodeid2con(i, 0); 387 con = __nodeid2con(i, 0);
387 if (!con) 388 if (!con)
@@ -393,7 +394,7 @@ static void sctp_init_failed(void)
393 } 394 }
394 } 395 }
395 } 396 }
396 up(&connections_lock); 397 mutex_unlock(&connections_lock);
397} 398}
398 399
399/* Something happened to an association */ 400/* Something happened to an association */
@@ -1417,7 +1418,7 @@ void dlm_lowcomms_stop(void)
1417 /* Set all the flags to prevent any 1418 /* Set all the flags to prevent any
1418 socket activity. 1419 socket activity.
1419 */ 1420 */
1420 down(&connections_lock); 1421 mutex_lock(&connections_lock);
1421 for (i = 0; i <= max_nodeid; i++) { 1422 for (i = 0; i <= max_nodeid; i++) {
1422 con = __nodeid2con(i, 0); 1423 con = __nodeid2con(i, 0);
1423 if (con) { 1424 if (con) {
@@ -1426,11 +1427,11 @@ void dlm_lowcomms_stop(void)
1426 con->sock->sk->sk_user_data = NULL; 1427 con->sock->sk->sk_user_data = NULL;
1427 } 1428 }
1428 } 1429 }
1429 up(&connections_lock); 1430 mutex_unlock(&connections_lock);
1430 1431
1431 work_stop(); 1432 work_stop();
1432 1433
1433 down(&connections_lock); 1434 mutex_lock(&connections_lock);
1434 clean_writequeues(); 1435 clean_writequeues();
1435 1436
1436 for (i = 0; i <= max_nodeid; i++) { 1437 for (i = 0; i <= max_nodeid; i++) {
@@ -1443,7 +1444,7 @@ void dlm_lowcomms_stop(void)
1443 } 1444 }
1444 } 1445 }
1445 max_nodeid = 0; 1446 max_nodeid = 0;
1446 up(&connections_lock); 1447 mutex_unlock(&connections_lock);
1447 kmem_cache_destroy(con_cache); 1448 kmem_cache_destroy(con_cache);
1448 idr_init(&connections_idr); 1449 idr_init(&connections_idr);
1449} 1450}