diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmmaster.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 27e984f7e4cd..847dd3cc4cf5 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -564,7 +564,7 @@ static void dlm_lockres_release(struct kref *kref) | |||
564 | 564 | ||
565 | /* By the time we're ready to blow this guy away, we shouldn't | 565 | /* By the time we're ready to blow this guy away, we shouldn't |
566 | * be on any lists. */ | 566 | * be on any lists. */ |
567 | BUG_ON(!list_empty(&res->list)); | 567 | BUG_ON(!hlist_unhashed(&res->hash_node)); |
568 | BUG_ON(!list_empty(&res->granted)); | 568 | BUG_ON(!list_empty(&res->granted)); |
569 | BUG_ON(!list_empty(&res->converting)); | 569 | BUG_ON(!list_empty(&res->converting)); |
570 | BUG_ON(!list_empty(&res->blocked)); | 570 | BUG_ON(!list_empty(&res->blocked)); |
@@ -605,7 +605,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, | |||
605 | 605 | ||
606 | init_waitqueue_head(&res->wq); | 606 | init_waitqueue_head(&res->wq); |
607 | spin_lock_init(&res->spinlock); | 607 | spin_lock_init(&res->spinlock); |
608 | INIT_LIST_HEAD(&res->list); | 608 | INIT_HLIST_NODE(&res->hash_node); |
609 | INIT_LIST_HEAD(&res->granted); | 609 | INIT_LIST_HEAD(&res->granted); |
610 | INIT_LIST_HEAD(&res->converting); | 610 | INIT_LIST_HEAD(&res->converting); |
611 | INIT_LIST_HEAD(&res->blocked); | 611 | INIT_LIST_HEAD(&res->blocked); |
@@ -1050,17 +1050,10 @@ static int dlm_restart_lock_mastery(struct dlm_ctxt *dlm, | |||
1050 | node = dlm_bitmap_diff_iter_next(&bdi, &sc); | 1050 | node = dlm_bitmap_diff_iter_next(&bdi, &sc); |
1051 | while (node >= 0) { | 1051 | while (node >= 0) { |
1052 | if (sc == NODE_UP) { | 1052 | if (sc == NODE_UP) { |
1053 | /* a node came up. easy. might not even need | 1053 | /* a node came up. clear any old vote from |
1054 | * to talk to it if its node number is higher | 1054 | * the response map and set it in the vote map |
1055 | * or if we are already blocked. */ | 1055 | * then restart the mastery. */ |
1056 | mlog(0, "node up! %d\n", node); | 1056 | mlog(ML_NOTICE, "node %d up while restarting\n", node); |
1057 | if (blocked) | ||
1058 | goto next; | ||
1059 | |||
1060 | if (node > dlm->node_num) { | ||
1061 | mlog(0, "node > this node. skipping.\n"); | ||
1062 | goto next; | ||
1063 | } | ||
1064 | 1057 | ||
1065 | /* redo the master request, but only for the new node */ | 1058 | /* redo the master request, but only for the new node */ |
1066 | mlog(0, "sending request to new node\n"); | 1059 | mlog(0, "sending request to new node\n"); |
@@ -2005,6 +1998,15 @@ fail: | |||
2005 | break; | 1998 | break; |
2006 | 1999 | ||
2007 | mlog(0, "timed out during migration\n"); | 2000 | mlog(0, "timed out during migration\n"); |
2001 | /* avoid hang during shutdown when migrating lockres | ||
2002 | * to a node which also goes down */ | ||
2003 | if (dlm_is_node_dead(dlm, target)) { | ||
2004 | mlog(0, "%s:%.*s: expected migration target %u " | ||
2005 | "is no longer up. restarting.\n", | ||
2006 | dlm->name, res->lockname.len, | ||
2007 | res->lockname.name, target); | ||
2008 | ret = -ERESTARTSYS; | ||
2009 | } | ||
2008 | } | 2010 | } |
2009 | if (ret == -ERESTARTSYS) { | 2011 | if (ret == -ERESTARTSYS) { |
2010 | /* migration failed, detach and clean up mle */ | 2012 | /* migration failed, detach and clean up mle */ |
@@ -2480,7 +2482,9 @@ top: | |||
2480 | atomic_set(&mle->woken, 1); | 2482 | atomic_set(&mle->woken, 1); |
2481 | spin_unlock(&mle->spinlock); | 2483 | spin_unlock(&mle->spinlock); |
2482 | wake_up(&mle->wq); | 2484 | wake_up(&mle->wq); |
2483 | /* final put will take care of list removal */ | 2485 | /* do not need events any longer, so detach |
2486 | * from heartbeat */ | ||
2487 | __dlm_mle_detach_hb_events(dlm, mle); | ||
2484 | __dlm_put_mle(mle); | 2488 | __dlm_put_mle(mle); |
2485 | } | 2489 | } |
2486 | continue; | 2490 | continue; |
@@ -2535,6 +2539,9 @@ top: | |||
2535 | spin_unlock(&res->spinlock); | 2539 | spin_unlock(&res->spinlock); |
2536 | dlm_lockres_put(res); | 2540 | dlm_lockres_put(res); |
2537 | 2541 | ||
2542 | /* about to get rid of mle, detach from heartbeat */ | ||
2543 | __dlm_mle_detach_hb_events(dlm, mle); | ||
2544 | |||
2538 | /* dump the mle */ | 2545 | /* dump the mle */ |
2539 | spin_lock(&dlm->master_lock); | 2546 | spin_lock(&dlm->master_lock); |
2540 | __dlm_put_mle(mle); | 2547 | __dlm_put_mle(mle); |