aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 21081bcfa091..78ba77bf3a77 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2000,6 +2000,23 @@ static void dlm_assert_master_worker(struct dlm_work_item *item, void *data)
2000 } 2000 }
2001 } 2001 }
2002 2002
2003 /*
2004 * If we're migrating this lock to someone else, we are no
2005 * longer allowed to assert out own mastery. OTOH, we need to
2006 * prevent migration from starting while we're still asserting
2007 * our dominance. The reserved ast delays migration.
2008 */
2009 spin_lock(&res->spinlock);
2010 if (res->state & DLM_LOCK_RES_MIGRATING) {
2011 mlog(0, "Someone asked us to assert mastery, but we're "
2012 "in the middle of migration. Skipping assert, "
2013 "the new master will handle that.\n");
2014 spin_unlock(&res->spinlock);
2015 goto put;
2016 } else
2017 __dlm_lockres_reserve_ast(res);
2018 spin_unlock(&res->spinlock);
2019
2003 /* this call now finishes out the nodemap 2020 /* this call now finishes out the nodemap
2004 * even if one or more nodes die */ 2021 * even if one or more nodes die */
2005 mlog(0, "worker about to master %.*s here, this=%u\n", 2022 mlog(0, "worker about to master %.*s here, this=%u\n",
@@ -2012,6 +2029,10 @@ static void dlm_assert_master_worker(struct dlm_work_item *item, void *data)
2012 mlog_errno(ret); 2029 mlog_errno(ret);
2013 } 2030 }
2014 2031
2032 /* Ok, we've asserted ourselves. Let's let migration start. */
2033 dlm_lockres_release_ast(dlm, res);
2034
2035put:
2015 dlm_lockres_put(res); 2036 dlm_lockres_put(res);
2016 2037
2017 mlog(0, "finished with dlm_assert_master_worker\n"); 2038 mlog(0, "finished with dlm_assert_master_worker\n");