]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/ocfs2/dlm/dlmrecovery.c
ocfs2: dlm: remove redundant code
[linux-beck.git] / fs / ocfs2 / dlm / dlmrecovery.c
index 9e4f862d20fe1749dc11f6d023793fccbed0069a..c5bdf02c213bd7ad5c086331a1ea8194bde40578 100644 (file)
@@ -1373,6 +1373,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
        char *buf = NULL;
        struct dlm_work_item *item = NULL;
        struct dlm_lock_resource *res = NULL;
+       unsigned int hash;
 
        if (!dlm_grab(dlm))
                return -EINVAL;
@@ -1400,7 +1401,10 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
        /* lookup the lock to see if we have a secondary queue for this
         * already...  just add the locks in and this will have its owner
         * and RECOVERY flag changed when it completes. */
-       res = dlm_lookup_lockres(dlm, mres->lockname, mres->lockname_len);
+       hash = dlm_lockid_hash(mres->lockname, mres->lockname_len);
+       spin_lock(&dlm->spinlock);
+       res = __dlm_lookup_lockres(dlm, mres->lockname, mres->lockname_len,
+                       hash);
        if (res) {
                /* this will get a ref on res */
                /* mark it as recovering/migrating and hash it */
@@ -1421,13 +1425,16 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
                                     mres->lockname_len, mres->lockname);
                                ret = -EFAULT;
                                spin_unlock(&res->spinlock);
+                               spin_unlock(&dlm->spinlock);
                                dlm_lockres_put(res);
                                goto leave;
                        }
                        res->state |= DLM_LOCK_RES_MIGRATING;
                }
                spin_unlock(&res->spinlock);
+               spin_unlock(&dlm->spinlock);
        } else {
+               spin_unlock(&dlm->spinlock);
                /* need to allocate, just like if it was
                 * mastered here normally  */
                res = dlm_new_lockres(dlm, mres->lockname, mres->lockname_len);
@@ -2450,11 +2457,7 @@ static void __dlm_hb_node_down(struct dlm_ctxt *dlm, int idx)
         * perhaps later we can genericize this for other waiters. */
        wake_up(&dlm->migration_wq);
 
-       if (test_bit(idx, dlm->recovery_map))
-               mlog(0, "domain %s, node %u already added "
-                    "to recovery map!\n", dlm->name, idx);
-       else
-               set_bit(idx, dlm->recovery_map);
+       set_bit(idx, dlm->recovery_map);
 }
 
 void dlm_hb_node_down_cb(struct o2nm_node *node, int idx, void *data)