ocfs2_dlm: Add missing locks in dlm_empty_lockres
authorSunil Mushran <sunil.mushran@oracle.com>
Mon, 12 Mar 2007 20:25:44 +0000 (13:25 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Wed, 14 Mar 2007 21:37:35 +0000 (14:37 -0700)
__dlm_lockres_unused() expects the caller to take the lockres spinlock.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/dlm/dlmmaster.c

index 77e4e6169a0df2d01c0adc0fb091038b4f53bc7b..9229e04362f67cd289ab01ec65d32a2939012401 100644 (file)
@@ -2730,14 +2730,17 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
        int ret;
        int lock_dropped = 0;
 
+       spin_lock(&res->spinlock);
        if (res->owner != dlm->node_num) {
                if (!__dlm_lockres_unused(res)) {
                        mlog(ML_ERROR, "%s:%.*s: this node is not master, "
                             "trying to free this but locks remain\n",
                             dlm->name, res->lockname.len, res->lockname.name);
                }
+               spin_unlock(&res->spinlock);
                goto leave;
        }
+       spin_unlock(&res->spinlock);
 
        /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
        spin_unlock(&dlm->spinlock);