diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmmaster.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 251c48028ea3..a65a87726d6a 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2707,8 +2707,15 @@ static int dlm_mark_lockres_migrating(struct dlm_ctxt *dlm, | |||
2707 | __dlm_lockres_reserve_ast(res); | 2707 | __dlm_lockres_reserve_ast(res); |
2708 | spin_unlock(&res->spinlock); | 2708 | spin_unlock(&res->spinlock); |
2709 | 2709 | ||
2710 | /* now flush all the pending asts.. hang out for a bit */ | 2710 | /* now flush all the pending asts */ |
2711 | dlm_kick_thread(dlm, res); | 2711 | dlm_kick_thread(dlm, res); |
2712 | /* before waiting on DIRTY, block processes which may | ||
2713 | * try to dirty the lockres before MIGRATING is set */ | ||
2714 | spin_lock(&res->spinlock); | ||
2715 | BUG_ON(res->state & DLM_LOCK_RES_BLOCK_DIRTY); | ||
2716 | res->state |= DLM_LOCK_RES_BLOCK_DIRTY; | ||
2717 | spin_unlock(&res->spinlock); | ||
2718 | /* now wait on any pending asts and the DIRTY state */ | ||
2712 | wait_event(dlm->ast_wq, !dlm_lockres_is_dirty(dlm, res)); | 2719 | wait_event(dlm->ast_wq, !dlm_lockres_is_dirty(dlm, res)); |
2713 | dlm_lockres_release_ast(dlm, res); | 2720 | dlm_lockres_release_ast(dlm, res); |
2714 | 2721 | ||
@@ -2734,6 +2741,13 @@ again: | |||
2734 | mlog(0, "trying again...\n"); | 2741 | mlog(0, "trying again...\n"); |
2735 | goto again; | 2742 | goto again; |
2736 | } | 2743 | } |
2744 | /* now that we are sure the MIGRATING state is there, drop | ||
2745 | * the unneded state which blocked threads trying to DIRTY */ | ||
2746 | spin_lock(&res->spinlock); | ||
2747 | BUG_ON(!(res->state & DLM_LOCK_RES_BLOCK_DIRTY)); | ||
2748 | BUG_ON(!(res->state & DLM_LOCK_RES_MIGRATING)); | ||
2749 | res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY; | ||
2750 | spin_unlock(&res->spinlock); | ||
2737 | 2751 | ||
2738 | /* did the target go down or die? */ | 2752 | /* did the target go down or die? */ |
2739 | spin_lock(&dlm->spinlock); | 2753 | spin_lock(&dlm->spinlock); |