Commit 516b7e52 authored by Sunil Mushran's avatar Sunil Mushran Committed by Mark Fasheh

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: default avatarSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 7141514b
...@@ -162,12 +162,28 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, ...@@ -162,12 +162,28 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
spin_lock(&res->spinlock); spin_lock(&res->spinlock);
if (!__dlm_lockres_unused(res)) { if (!__dlm_lockres_unused(res)) {
spin_unlock(&res->spinlock);
mlog(0, "%s:%.*s: tried to purge but not unused\n", mlog(0, "%s:%.*s: tried to purge but not unused\n",
dlm->name, res->lockname.len, res->lockname.name); dlm->name, res->lockname.len, res->lockname.name);
return -ENOTEMPTY; __dlm_print_one_lock_resource(res);
spin_unlock(&res->spinlock);
BUG();
} }
if (res->state & DLM_LOCK_RES_MIGRATING) {
mlog(0, "%s:%.*s: Delay dropref as this lockres is "
"being remastered\n", dlm->name, res->lockname.len,
res->lockname.name);
/* Re-add the lockres to the end of the purge list */
if (!list_empty(&res->purge)) {
list_del_init(&res->purge);
list_add_tail(&res->purge, &dlm->purge_list);
}
spin_unlock(&res->spinlock);
return 0;
}
master = (res->owner == dlm->node_num); master = (res->owner == dlm->node_num);
if (!master) if (!master)
res->state |= DLM_LOCK_RES_DROPPING_REF; res->state |= DLM_LOCK_RES_DROPPING_REF;
spin_unlock(&res->spinlock); spin_unlock(&res->spinlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment