void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
 {
+       if (!(gl->gl_ops->go_flags & GLOF_LRU))
+               return;
+
        spin_lock(&lru_lock);
 
-       if (!list_empty(&gl->gl_lru))
-               list_del_init(&gl->gl_lru);
-       else
+       list_del(&gl->gl_lru);
+       list_add_tail(&gl->gl_lru, &lru_list);
+
+       if (!test_bit(GLF_LRU, &gl->gl_flags)) {
+               set_bit(GLF_LRU, &gl->gl_flags);
                atomic_inc(&lru_count);
+       }
 
-       list_add_tail(&gl->gl_lru, &lru_list);
-       set_bit(GLF_LRU, &gl->gl_flags);
        spin_unlock(&lru_lock);
 }
 
                return;
 
        spin_lock(&lru_lock);
-       if (!list_empty(&gl->gl_lru)) {
+       if (test_bit(GLF_LRU, &gl->gl_flags)) {
                list_del_init(&gl->gl_lru);
                atomic_dec(&lru_count);
                clear_bit(GLF_LRU, &gl->gl_flags);
                    !test_bit(GLF_DEMOTE, &gl->gl_flags))
                        fast_path = 1;
        }
-       if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl) &&
-           (glops->go_flags & GLOF_LRU))
+       if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl))
                gfs2_glock_add_to_lru(gl);
 
        trace_gfs2_glock_queue(gh, 0);
                if (!spin_trylock(&gl->gl_lockref.lock)) {
 add_back_to_lru:
                        list_add(&gl->gl_lru, &lru_list);
+                       set_bit(GLF_LRU, &gl->gl_flags);
                        atomic_inc(&lru_count);
                        continue;
                }
                        spin_unlock(&gl->gl_lockref.lock);
                        goto add_back_to_lru;
                }
-               clear_bit(GLF_LRU, &gl->gl_flags);
                gl->gl_lockref.count++;
                if (demote_ok(gl))
                        handle_callback(gl, LM_ST_UNLOCKED, 0, false);
                if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
                        list_move(&gl->gl_lru, &dispose);
                        atomic_dec(&lru_count);
+                       clear_bit(GLF_LRU, &gl->gl_flags);
                        freed++;
                        continue;
                }