mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
860da5e578
commit
7a936ce71e
|
@ -50,6 +50,7 @@
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <linux/sctp.h>
|
#include <linux/sctp.h>
|
||||||
#include <net/sctp/user.h>
|
#include <net/sctp/user.h>
|
||||||
|
|
||||||
|
@ -138,7 +139,7 @@ static struct workqueue_struct *recv_workqueue;
|
||||||
static struct workqueue_struct *send_workqueue;
|
static struct workqueue_struct *send_workqueue;
|
||||||
|
|
||||||
static DEFINE_IDR(connections_idr);
|
static DEFINE_IDR(connections_idr);
|
||||||
static DECLARE_MUTEX(connections_lock);
|
static DEFINE_MUTEX(connections_lock);
|
||||||
static int max_nodeid;
|
static int max_nodeid;
|
||||||
static struct kmem_cache *con_cache;
|
static struct kmem_cache *con_cache;
|
||||||
|
|
||||||
|
@ -205,9 +206,9 @@ static struct connection *nodeid2con(int nodeid, gfp_t allocation)
|
||||||
{
|
{
|
||||||
struct connection *con;
|
struct connection *con;
|
||||||
|
|
||||||
down(&connections_lock);
|
mutex_lock(&connections_lock);
|
||||||
con = __nodeid2con(nodeid, allocation);
|
con = __nodeid2con(nodeid, allocation);
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
|
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
|
@ -218,15 +219,15 @@ static struct connection *assoc2con(int assoc_id)
|
||||||
int i;
|
int i;
|
||||||
struct connection *con;
|
struct connection *con;
|
||||||
|
|
||||||
down(&connections_lock);
|
mutex_lock(&connections_lock);
|
||||||
for (i=0; i<=max_nodeid; i++) {
|
for (i=0; i<=max_nodeid; i++) {
|
||||||
con = __nodeid2con(i, 0);
|
con = __nodeid2con(i, 0);
|
||||||
if (con && con->sctp_assoc == assoc_id) {
|
if (con && con->sctp_assoc == assoc_id) {
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +382,7 @@ static void sctp_init_failed(void)
|
||||||
int i;
|
int i;
|
||||||
struct connection *con;
|
struct connection *con;
|
||||||
|
|
||||||
down(&connections_lock);
|
mutex_lock(&connections_lock);
|
||||||
for (i=1; i<=max_nodeid; i++) {
|
for (i=1; i<=max_nodeid; i++) {
|
||||||
con = __nodeid2con(i, 0);
|
con = __nodeid2con(i, 0);
|
||||||
if (!con)
|
if (!con)
|
||||||
|
@ -393,7 +394,7 @@ static void sctp_init_failed(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Something happened to an association */
|
/* Something happened to an association */
|
||||||
|
@ -1417,7 +1418,7 @@ void dlm_lowcomms_stop(void)
|
||||||
/* Set all the flags to prevent any
|
/* Set all the flags to prevent any
|
||||||
socket activity.
|
socket activity.
|
||||||
*/
|
*/
|
||||||
down(&connections_lock);
|
mutex_lock(&connections_lock);
|
||||||
for (i = 0; i <= max_nodeid; i++) {
|
for (i = 0; i <= max_nodeid; i++) {
|
||||||
con = __nodeid2con(i, 0);
|
con = __nodeid2con(i, 0);
|
||||||
if (con) {
|
if (con) {
|
||||||
|
@ -1426,11 +1427,11 @@ void dlm_lowcomms_stop(void)
|
||||||
con->sock->sk->sk_user_data = NULL;
|
con->sock->sk->sk_user_data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
|
|
||||||
work_stop();
|
work_stop();
|
||||||
|
|
||||||
down(&connections_lock);
|
mutex_lock(&connections_lock);
|
||||||
clean_writequeues();
|
clean_writequeues();
|
||||||
|
|
||||||
for (i = 0; i <= max_nodeid; i++) {
|
for (i = 0; i <= max_nodeid; i++) {
|
||||||
|
@ -1443,7 +1444,7 @@ void dlm_lowcomms_stop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
max_nodeid = 0;
|
max_nodeid = 0;
|
||||||
up(&connections_lock);
|
mutex_unlock(&connections_lock);
|
||||||
kmem_cache_destroy(con_cache);
|
kmem_cache_destroy(con_cache);
|
||||||
idr_init(&connections_idr);
|
idr_init(&connections_idr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue