From 7a936ce71eed7b887b8a0d6c54dd8a9072f71c9f Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Mon, 12 May 2008 10:04:51 -0500 Subject: 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 Cc: Christine Caulfield Cc: David Teigland Cc: Steven Whitehouse Signed-off-by: Andrew Morton Signed-off-by: David Teigland --- fs/dlm/lowcomms.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'fs/dlm') diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 7c1e5e5cccd..c7d232a9ae1 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -138,7 +139,7 @@ static struct workqueue_struct *recv_workqueue; static struct workqueue_struct *send_workqueue; static DEFINE_IDR(connections_idr); -static DECLARE_MUTEX(connections_lock); +static DEFINE_MUTEX(connections_lock); static int max_nodeid; static struct kmem_cache *con_cache; @@ -205,9 +206,9 @@ static struct connection *nodeid2con(int nodeid, gfp_t allocation) { struct connection *con; - down(&connections_lock); + mutex_lock(&connections_lock); con = __nodeid2con(nodeid, allocation); - up(&connections_lock); + mutex_unlock(&connections_lock); return con; } @@ -218,15 +219,15 @@ static struct connection *assoc2con(int assoc_id) int i; struct connection *con; - down(&connections_lock); + mutex_lock(&connections_lock); for (i=0; i<=max_nodeid; i++) { con = __nodeid2con(i, 0); if (con && con->sctp_assoc == assoc_id) { - up(&connections_lock); + mutex_unlock(&connections_lock); return con; } } - up(&connections_lock); + mutex_unlock(&connections_lock); return NULL; } @@ -381,7 +382,7 @@ static void sctp_init_failed(void) int i; struct connection *con; - down(&connections_lock); + mutex_lock(&connections_lock); for (i=1; i<=max_nodeid; i++) { con = __nodeid2con(i, 0); if (!con) @@ -393,7 +394,7 @@ static void sctp_init_failed(void) } } } - up(&connections_lock); + mutex_unlock(&connections_lock); } /* Something happened to an association */ @@ -1417,7 +1418,7 @@ void dlm_lowcomms_stop(void) /* Set all the flags to prevent any socket activity. */ - down(&connections_lock); + mutex_lock(&connections_lock); for (i = 0; i <= max_nodeid; i++) { con = __nodeid2con(i, 0); if (con) { @@ -1426,11 +1427,11 @@ void dlm_lowcomms_stop(void) con->sock->sk->sk_user_data = NULL; } } - up(&connections_lock); + mutex_unlock(&connections_lock); work_stop(); - down(&connections_lock); + mutex_lock(&connections_lock); clean_writequeues(); for (i = 0; i <= max_nodeid; i++) { @@ -1443,7 +1444,7 @@ void dlm_lowcomms_stop(void) } } max_nodeid = 0; - up(&connections_lock); + mutex_unlock(&connections_lock); kmem_cache_destroy(con_cache); idr_init(&connections_idr); } -- cgit v1.2.3 From 88ad23195e4609cef73b6fcf2b4c08aaaef33204 Mon Sep 17 00:00:00 2001 From: Leonardo Potenza Date: Sun, 11 May 2008 19:15:34 +0200 Subject: dlm: section mismatch warning fix Removed the section mismatch message: WARNING: fs/dlm/dlm.o(.init.text+0x132): Section mismatch in reference from the function init_module() to the function .exit.text:dlm_netlink_exit() Since dlm_netlink_exit() is called in the init_dlm() error handling, the __exit annotation has been removed. Signed-off-by: Leonardo Potenza Signed-off-by: David Teigland --- fs/dlm/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/dlm') diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 714593621f4..18bda83cc89 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c @@ -95,7 +95,7 @@ int __init dlm_netlink_init(void) return rv; } -void __exit dlm_netlink_exit(void) +void dlm_netlink_exit(void) { genl_unregister_ops(&family, &dlm_nl_ops); genl_unregister_family(&family); -- cgit v1.2.3 From 0035a4b14931eb62a5f8a7762284c18e7ab14289 Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Sun, 11 May 2008 22:01:29 +0200 Subject: dlm: tcp_connect_to_sock should check for -EINVAL, not EINVAL Signed-off-by: Marcin Slusarz Cc: Christine Caulfield Cc: David Teigland Cc: cluster-devel@redhat.com Signed-off-by: David Teigland --- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/dlm') diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index c7d232a9ae1..637018c891e 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -931,7 +931,7 @@ out_err: * errors we try again until the max number of retries is reached. */ if (result != -EHOSTUNREACH && result != -ENETUNREACH && - result != -ENETDOWN && result != EINVAL + result != -ENETDOWN && result != -EINVAL && result != -EPROTONOSUPPORT) { lowcomms_connect_sock(con); result = 0; -- cgit v1.2.3 From 817d10bad56f2fdfa321b4a864a21295226b123a Mon Sep 17 00:00:00 2001 From: David Teigland Date: Tue, 13 May 2008 14:28:26 -0500 Subject: dlm: fix plock dev_write return value The return value on writes to the plock device should be the number of bytes written. It was returning 0 instead when an nfs lock callback was involved. Reported-by: Nathan Straz Signed-off-by: David Teigland --- fs/dlm/plock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/dlm') diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index d6d6e370f89..78878c5781c 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -379,7 +379,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, struct plock_xop *xop; xop = (struct plock_xop *)op; if (xop->callback) - count = dlm_plock_callback(op); + dlm_plock_callback(op); else wake_up(&recv_wq); } else -- cgit v1.2.3