diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
| -rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 46 | 
1 files changed, 25 insertions, 21 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 8b3382abf84..39efc5057a3 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -43,8 +43,6 @@  #include "dlmdomain.h"  #include "dlmdebug.h" -#include "dlmver.h" -  #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_DOMAIN)  #include "cluster/masklog.h" @@ -961,6 +959,14 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data,  		 * domain. Set him in the map and clean up our  		 * leftover join state. */  		BUG_ON(dlm->joining_node != assert->node_idx); + +		if (dlm->reco.state & DLM_RECO_STATE_ACTIVE) { +			mlog(0, "dlm recovery is ongoing, disallow join\n"); +			spin_unlock(&dlm->spinlock); +			spin_unlock(&dlm_domain_lock); +			return -EAGAIN; +		} +  		set_bit(assert->node_idx, dlm->domain_map);  		clear_bit(assert->node_idx, dlm->exit_domain_map);  		__dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); @@ -1125,7 +1131,6 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,  	struct dlm_ctxt *dlm = NULL;  	char *local = NULL;  	int status = 0; -	int locked = 0;  	qr = (struct dlm_query_region *) msg->buf; @@ -1134,10 +1139,8 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,  	/* buffer used in dlm_mast_regions() */  	local = kmalloc(sizeof(qr->qr_regions), GFP_KERNEL); -	if (!local) { -		status = -ENOMEM; -		goto bail; -	} +	if (!local) +		return -ENOMEM;  	status = -EINVAL; @@ -1146,16 +1149,15 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,  	if (!dlm) {  		mlog(ML_ERROR, "Node %d queried hb regions on domain %s "  		     "before join domain\n", qr->qr_node, qr->qr_domain); -		goto bail; +		goto out_domain_lock;  	}  	spin_lock(&dlm->spinlock); -	locked = 1;  	if (dlm->joining_node != qr->qr_node) {  		mlog(ML_ERROR, "Node %d queried hb regions on domain %s "  		     "but joining node is %d\n", qr->qr_node, qr->qr_domain,  		     dlm->joining_node); -		goto bail; +		goto out_dlm_lock;  	}  	/* Support for global heartbeat was added in 1.1 */ @@ -1165,14 +1167,15 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,  		     "but active dlm protocol is %d.%d\n", qr->qr_node,  		     qr->qr_domain, dlm->dlm_locking_proto.pv_major,  		     dlm->dlm_locking_proto.pv_minor); -		goto bail; +		goto out_dlm_lock;  	}  	status = dlm_match_regions(dlm, qr, local, sizeof(qr->qr_regions)); -bail: -	if (locked) -		spin_unlock(&dlm->spinlock); +out_dlm_lock: +	spin_unlock(&dlm->spinlock); + +out_domain_lock:  	spin_unlock(&dlm_domain_lock);  	kfree(local); @@ -1522,6 +1525,7 @@ static int dlm_send_one_join_assert(struct dlm_ctxt *dlm,  				    unsigned int node)  {  	int status; +	int ret;  	struct dlm_assert_joined assert_msg;  	mlog(0, "Sending join assert to node %u\n", node); @@ -1533,11 +1537,13 @@ static int dlm_send_one_join_assert(struct dlm_ctxt *dlm,  	status = o2net_send_message(DLM_ASSERT_JOINED_MSG, DLM_MOD_KEY,  				    &assert_msg, sizeof(assert_msg), node, -				    NULL); +				    &ret);  	if (status < 0)  		mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to "  		     "node %u\n", status, DLM_ASSERT_JOINED_MSG, DLM_MOD_KEY,  		     node); +	else +		status = ret;  	return status;  } @@ -1879,19 +1885,19 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)  		goto bail;  	} -	status = dlm_debug_init(dlm); +	status = dlm_launch_thread(dlm);  	if (status < 0) {  		mlog_errno(status);  		goto bail;  	} -	status = dlm_launch_thread(dlm); +	status = dlm_launch_recovery_thread(dlm);  	if (status < 0) {  		mlog_errno(status);  		goto bail;  	} -	status = dlm_launch_recovery_thread(dlm); +	status = dlm_debug_init(dlm);  	if (status < 0) {  		mlog_errno(status);  		goto bail; @@ -2028,7 +2034,6 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,  	INIT_LIST_HEAD(&dlm->list);  	INIT_LIST_HEAD(&dlm->dirty_list);  	INIT_LIST_HEAD(&dlm->reco.resources); -	INIT_LIST_HEAD(&dlm->reco.received);  	INIT_LIST_HEAD(&dlm->reco.node_data);  	INIT_LIST_HEAD(&dlm->purge_list);  	INIT_LIST_HEAD(&dlm->dlm_domain_handlers); @@ -2328,8 +2333,6 @@ static int __init dlm_init(void)  {  	int status; -	dlm_print_version(); -  	status = dlm_init_mle_cache();  	if (status) {  		mlog(ML_ERROR, "Could not create o2dlm_mle slabcache\n"); @@ -2379,6 +2382,7 @@ static void __exit dlm_exit (void)  MODULE_AUTHOR("Oracle");  MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("OCFS2 Distributed Lock Management");  module_init(dlm_init);  module_exit(dlm_exit);  | 
