gfs2: Unlock fewer glocks on unmount
[linux-2.6-block.git] / fs / gfs2 / lock_dlm.c
index e028e55e67d95fa483daeb9b791c9ef7f8b4d3c1..49059274a5288be6038cdf7387c539508dbb080e 100644 (file)
@@ -316,10 +316,16 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
                gfs2_glock_free(gl);
                return;
        }
-       /* don't want to skip dlm_unlock writing the lvb when lock has one */
+
+       /*
+        * When the lockspace is released, all remaining glocks will be
+        * unlocked automatically.  This is more efficient than unlocking them
+        * individually, but when the lock is held in DLM_LOCK_EX or
+        * DLM_LOCK_PW mode, the lock value block (LVB) will be lost.
+        */
 
        if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
-           !gl->gl_lksb.sb_lvbptr) {
+           (!gl->gl_lksb.sb_lvbptr || gl->gl_state != LM_ST_EXCLUSIVE)) {
                gfs2_glock_free_later(gl);
                return;
        }