public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] xfs: fix buffer flushing during log unmount
@ 2012-02-15 11:56 Amit Sahrawat
  2012-02-15 12:26 ` Amit Sahrawat
  2012-02-17 19:15 ` Christoph Hellwig
  0 siblings, 2 replies; 7+ messages in thread
From: Amit Sahrawat @ 2012-02-15 11:56 UTC (permalink / raw)
  To: Ben Myers, Alex Elder, Christoph Hellwig, Dave Chinner,
	xfs-masters, xfs
  Cc: Nam-Jae Jeon, linux-kernel, Amit Sahrawat

Whenever there is a mount/unmount failure - there is a chance of calling the
callbacks functions once - transaction ail mount pointer is destroyed. So, it results
in NULL pointer exception followed by hang. So, before unmount of the log - flush all
the pending buffers.

Signed-off-by: Amit Sahrawat <amit.sahrawat83@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
---
 fs/xfs/xfs_log.c   |   10 ++++++++++
 fs/xfs/xfs_mount.c |    9 ---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index e2cc356..b924a5b 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -739,6 +739,16 @@ xfs_log_unmount_write(xfs_mount_t *mp)
 void
 xfs_log_unmount(xfs_mount_t *mp)
 {
+	int error = 0;
+	/*
+	 * Make sure all buffers have been flushed and completed before
+	 * unmounting the log.
+	 */
+	error = xfs_flush_buftarg(mp->m_ddev_targp, 1);
+	if (error)
+		cmn_err(CE_WARN, "%d busy buffers during log unmount.", error);
+	xfs_wait_buftarg(mp->m_ddev_targp);
+	
 	xfs_trans_ail_destroy(mp);
 	xlog_dealloc_log(mp->m_log);
 }
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index d06afbc..3bd2246 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1519,15 +1519,6 @@ xfs_unmountfs(
 				"Freespace may not be correct on next mount.");
 	xfs_unmountfs_writesb(mp);
 
-	/*
-	 * Make sure all buffers have been flushed and completed before
-	 * unmounting the log.
-	 */
-	error = xfs_flush_buftarg(mp->m_ddev_targp, 1);
-	if (error)
-		xfs_warn(mp, "%d busy buffers during unmount.", error);
-	xfs_wait_buftarg(mp->m_ddev_targp);
-
 	xfs_log_unmount_write(mp);
 	xfs_log_unmount(mp);
 	xfs_uuid_unmount(mp);
-- 
1.7.2.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-20  1:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 11:56 [PATCH 1/1] xfs: fix buffer flushing during log unmount Amit Sahrawat
2012-02-15 12:26 ` Amit Sahrawat
2012-02-17  5:38   ` Namjae Jeon
2012-02-17 19:15 ` Christoph Hellwig
2012-02-18 16:30   ` Amit Sahrawat
2012-02-19 22:27     ` Christoph Hellwig
2012-02-20  1:33     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox