]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/gfs2/glock.c
GFS2: Only wait for demote when last holder is dequeued
[linux.git] / fs / gfs2 / glock.c
index c355f7320e448bfe30a8c325b2448d707f8c19be..278fae5b6982f81ca3ee8c17d830ad28d2ab47c6 100644 (file)
@@ -1128,7 +1128,9 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh)
        struct gfs2_glock *gl = gh->gh_gl;
        gfs2_glock_dq(gh);
        might_sleep();
-       wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE);
+       if (!find_first_holder(gl))
+               wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait,
+                           TASK_UNINTERRUPTIBLE);
 }
 
 /**