GFS2: Wait for unlock completion on umount
[pandora-kernel.git] / fs / gfs2 / super.c
index c282ad4..66242b3 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/time.h>
+#include <linux/wait.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -860,6 +861,8 @@ restart:
        gfs2_jindex_free(sdp);
        /*  Take apart glock structures and buffer lists  */
        gfs2_gl_hash_clear(sdp);
+       /* Wait for dlm to reply to all our unlock requests */
+       wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0);
        /*  Unmount the locking protocol  */
        gfs2_lm_unmount(sdp);