diff options
author | Kurt Hackel <kurt.hackel@oracle.com> | 2006-05-01 16:32:27 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-06-26 17:43:08 -0400 |
commit | 36407488b1cbc4d84bc2bd14e03f3f9b768090d9 (patch) | |
tree | c3b010ef79b59e531f34c7fdf7c8d3575c62a405 /fs/ocfs2/dlm/dlmmaster.c | |
parent | c87a9ae7059f718bf1bb87a702fcbef535e32111 (diff) |
ocfs2: pending mastery asserts and migrations should block each other
Use the existing structure for blocking migrations when ASTs are pending to
achieve the same result. If we can catch the assert before it goes on the
wire, just cancel it and let the migration continue.
Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmmaster.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 21 |
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 | |||
2035 | put: | ||
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"); |