Commit 32e49326 authored by xuejiufei's avatar xuejiufei Committed by Linus Torvalds

ocfs2/dlm: do not insert a new mle when another process is already migrating

When two processes are migrating the same lockres,
dlm_add_migration_mle() return -EEXIST, but insert a new mle in hash
list.  dlm_migrate_lockres() will detach the old mle and free the new
one which is already in hash list, that will destroy the list.
Signed-off-by: default avatarJiufei Xue <>
Reviewed-by: default avatarJoseph Qi <>
Cc: Mark Fasheh <>
Cc: Joel Becker <>
Reviewed-by: default avatarJunxiao Bi <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent bef5502d
...@@ -2549,7 +2549,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, ...@@ -2549,7 +2549,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
} }
fail: fail:
if (oldmle) { if (ret != -EEXIST && oldmle) {
/* master is known, detach if not already detached */ /* master is known, detach if not already detached */
dlm_mle_detach_hb_events(dlm, oldmle); dlm_mle_detach_hb_events(dlm, oldmle);
dlm_put_mle(oldmle); dlm_put_mle(oldmle);
...@@ -3136,7 +3136,8 @@ static int dlm_add_migration_mle(struct dlm_ctxt *dlm, ...@@ -3136,7 +3136,8 @@ static int dlm_add_migration_mle(struct dlm_ctxt *dlm,
mlog(0, "tried to migrate %.*s, but some " mlog(0, "tried to migrate %.*s, but some "
"process beat me to it\n", "process beat me to it\n",
namelen, name); namelen, name);
ret = -EEXIST; spin_unlock(&tmp->spinlock);
return -EEXIST;
} else { } else {
/* bad. 2 NODES are trying to migrate! */ /* bad. 2 NODES are trying to migrate! */
mlog(ML_ERROR, "migration error mle: " mlog(ML_ERROR, "migration error mle: "
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