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: Jiufei Xue <xuejiufei@huawei.com>
Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
        }
 
 fail:
-       if (oldmle) {
+       if (ret != -EEXIST && oldmle) {
                /* master is known, detach if not already detached */
                dlm_mle_detach_hb_events(dlm, oldmle);
                dlm_put_mle(oldmle);
                                mlog(0, "tried to migrate %.*s, but some "
                                     "process beat me to it\n",
                                     namelen, name);
-                               ret = -EEXIST;
+                               spin_unlock(&tmp->spinlock);
+                               return -EEXIST;
                        } else {
                                /* bad.  2 NODES are trying to migrate! */
                                mlog(ML_ERROR, "migration error  mle: "