]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/dlm/dlmthread.c
Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / fs / ocfs2 / dlm / dlmthread.c
index dd78ca3f360fe1c984ab64b01d55f06b2c5629dc..2211acf33d9b9be5937ca86c633cd72c013ffd2d 100644 (file)
@@ -92,19 +92,27 @@ int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
  * truly ready to be freed. */
 int __dlm_lockres_unused(struct dlm_lock_resource *res)
 {
-       if (!__dlm_lockres_has_locks(res) &&
-           (list_empty(&res->dirty) && !(res->state & DLM_LOCK_RES_DIRTY))) {
-               /* try not to scan the bitmap unless the first two
-                * conditions are already true */
-               int bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
-               if (bit >= O2NM_MAX_NODES) {
-                       /* since the bit for dlm->node_num is not
-                        * set, inflight_locks better be zero */
-                       BUG_ON(res->inflight_locks != 0);
-                       return 1;
-               }
-       }
-       return 0;
+       int bit;
+
+       if (__dlm_lockres_has_locks(res))
+               return 0;
+
+       if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY)
+               return 0;
+
+       if (res->state & DLM_LOCK_RES_RECOVERING)
+               return 0;
+
+       bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
+       if (bit < O2NM_MAX_NODES)
+               return 0;
+
+       /*
+        * since the bit for dlm->node_num is not set, inflight_locks better
+        * be zero
+        */
+       BUG_ON(res->inflight_locks != 0);
+       return 1;
 }