Commit e17e75ec authored by Kurt Hackel's avatar Kurt Hackel Committed by Mark Fasheh

ocfs2_dlm: Fix migrate lockres handler queue scanning

The migrate lockres handler was only searching for its lock on
migrated lockres on the expected queue. This could be problematic
as the new master could have also issued a convert request
during the migration and thus moved the lock to the convert queue.
We now search for the lock on all three queues.
Signed-off-by: default avatarKurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: default avatarSunil Mushran <Sunil.Mushran@oracle.com>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 71ac1062
...@@ -1708,10 +1708,11 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, ...@@ -1708,10 +1708,11 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
{ {
struct dlm_migratable_lock *ml; struct dlm_migratable_lock *ml;
struct list_head *queue; struct list_head *queue;
struct list_head *tmpq = NULL;
struct dlm_lock *newlock = NULL; struct dlm_lock *newlock = NULL;
struct dlm_lockstatus *lksb = NULL; struct dlm_lockstatus *lksb = NULL;
int ret = 0; int ret = 0;
int i, bad; int i, j, bad;
struct list_head *iter; struct list_head *iter;
struct dlm_lock *lock = NULL; struct dlm_lock *lock = NULL;
u8 from = O2NM_MAX_NODES; u8 from = O2NM_MAX_NODES;
...@@ -1738,6 +1739,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, ...@@ -1738,6 +1739,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
lksb = NULL; lksb = NULL;
queue = dlm_list_num_to_pointer(res, ml->list); queue = dlm_list_num_to_pointer(res, ml->list);
tmpq = NULL;
/* if the lock is for the local node it needs to /* if the lock is for the local node it needs to
* be moved to the proper location within the queue. * be moved to the proper location within the queue.
...@@ -1747,13 +1749,18 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, ...@@ -1747,13 +1749,18 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
BUG_ON(!(mres->flags & DLM_MRES_MIGRATION)); BUG_ON(!(mres->flags & DLM_MRES_MIGRATION));
spin_lock(&res->spinlock); spin_lock(&res->spinlock);
list_for_each(iter, queue) { for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
tmpq = dlm_list_idx_to_ptr(res, j);
list_for_each(iter, tmpq) {
lock = list_entry (iter, struct dlm_lock, list); lock = list_entry (iter, struct dlm_lock, list);
if (lock->ml.cookie != ml->cookie) if (lock->ml.cookie != ml->cookie)
lock = NULL; lock = NULL;
else else
break; break;
} }
if (lock)
break;
}
/* lock is always created locally first, and /* lock is always created locally first, and
* destroyed locally last. it must be on the list */ * destroyed locally last. it must be on the list */
...@@ -1768,6 +1775,13 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, ...@@ -1768,6 +1775,13 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
} }
BUG_ON(lock->ml.node != ml->node); BUG_ON(lock->ml.node != ml->node);
if (tmpq != queue) {
mlog(0, "lock was on %u instead of %u for %.*s\n",
j, ml->list, res->lockname.len, res->lockname.name);
spin_unlock(&res->spinlock);
continue;
}
/* see NOTE above about why we do not update /* see NOTE above about why we do not update
* to match the master here */ * to match the master here */
......
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