[PATCH for-2.6.33] xfs: flush all log buffers in xlog_dealloc_log

Christoph Hellwig
2010-02-01T22:07:07Z

Make sure all log buffers have made it to disk before we free them.
Otherwise we might reference freed buffers or a NULL mp->m_log from
the I/O completion handlers.

This fixes kernel.org bz #15150.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Ed Cashin <ecashin@coraid.com>
Reported-by: ghani <abdelghani@ezono.com>
Tested-by: ghani <abdelghani@ezono.com>

Index: linux-2.6/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_log.c 2009-11-09 22:09:08.858026060 +0100
+++ linux-2.6/fs/xfs/xfs_log.c 2009-11-09 22:13:13.958255857 +0100
@@ -1602,6 +1602,8 @@ xlog_dealloc_log(xlog_t *log)
xlog_in_core_t *iclog, *next_iclog;
int i;

+ xfs_flush_buftarg(log->l_mp->m_logdev_targp, 1);
+
iclog = log->l_iclog;
for (i=0; i<log->l_iclog_bufs; i++) {
sv_destroy(&iclog->ic_force_wait);