diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2009-02-26 18:00:48 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-04-03 14:39:24 -0400 |
commit | 516b7e52abc7efd61c084b217c61985a403828ed (patch) | |
tree | 80bd45f16b00bd009e6a0306cec430d0ef7b49bc /fs/ocfs2 | |
parent | 7141514b8307734c117f100c4a3637887c5def45 (diff) |
ocfs2/dlm: Do not purge lockres that is being migrated dlm_purge_lockres()
This patch attempts to fix a fine race between purging and migration.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 4060bb328bc8..d490b66ad9d7 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -162,12 +162,28 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
162 | 162 | ||
163 | spin_lock(&res->spinlock); | 163 | spin_lock(&res->spinlock); |
164 | if (!__dlm_lockres_unused(res)) { | 164 | if (!__dlm_lockres_unused(res)) { |
165 | spin_unlock(&res->spinlock); | ||
166 | mlog(0, "%s:%.*s: tried to purge but not unused\n", | 165 | mlog(0, "%s:%.*s: tried to purge but not unused\n", |
167 | dlm->name, res->lockname.len, res->lockname.name); | 166 | dlm->name, res->lockname.len, res->lockname.name); |
168 | return -ENOTEMPTY; | 167 | __dlm_print_one_lock_resource(res); |
168 | spin_unlock(&res->spinlock); | ||
169 | BUG(); | ||
169 | } | 170 | } |
171 | |||
172 | if (res->state & DLM_LOCK_RES_MIGRATING) { | ||
173 | mlog(0, "%s:%.*s: Delay dropref as this lockres is " | ||
174 | "being remastered\n", dlm->name, res->lockname.len, | ||
175 | res->lockname.name); | ||
176 | /* Re-add the lockres to the end of the purge list */ | ||
177 | if (!list_empty(&res->purge)) { | ||
178 | list_del_init(&res->purge); | ||
179 | list_add_tail(&res->purge, &dlm->purge_list); | ||
180 | } | ||
181 | spin_unlock(&res->spinlock); | ||
182 | return 0; | ||
183 | } | ||
184 | |||
170 | master = (res->owner == dlm->node_num); | 185 | master = (res->owner == dlm->node_num); |
186 | |||
171 | if (!master) | 187 | if (!master) |
172 | res->state |= DLM_LOCK_RES_DROPPING_REF; | 188 | res->state |= DLM_LOCK_RES_DROPPING_REF; |
173 | spin_unlock(&res->spinlock); | 189 | spin_unlock(&res->spinlock); |