]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/dlm/dlmmaster.c
ocfs2/dlm: do not get resource spinlock if lockres is new
[karo-tx-linux.git] / fs / ocfs2 / dlm / dlmmaster.c
index 3ec906ef5d9a622ff4b130f12907d503bd89c3e0..e3cfa0227026c64df16edc3705d9e607a16f6509 100644 (file)
@@ -655,12 +655,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm,
        clear_bit(bit, res->refmap);
 }
 
-
-void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm,
+static void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm,
                                   struct dlm_lock_resource *res)
 {
-       assert_spin_locked(&res->spinlock);
-
        res->inflight_locks++;
 
        mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name,
@@ -668,6 +665,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm,
             __builtin_return_address(0));
 }
 
+void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm,
+                                  struct dlm_lock_resource *res)
+{
+       assert_spin_locked(&res->spinlock);
+       __dlm_lockres_grab_inflight_ref(dlm, res);
+}
+
 void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm,
                                   struct dlm_lock_resource *res)
 {
@@ -894,10 +898,8 @@ lookup:
        /* finally add the lockres to its hash bucket */
        __dlm_insert_lockres(dlm, res);
 
-       /* Grab inflight ref to pin the resource */
-       spin_lock(&res->spinlock);
-       dlm_lockres_grab_inflight_ref(dlm, res);
-       spin_unlock(&res->spinlock);
+       /* since this lockres is new it doesn't not require the spinlock */
+       __dlm_lockres_grab_inflight_ref(dlm, res);
 
        /* get an extra ref on the mle in case this is a BLOCK
         * if so, the creator of the BLOCK may try to put the last