xfs
[Top] [All Lists]

[PATCH 1/1] xfs: fix buffer flushing during log unmount

To: Ben Myers <bpm@xxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx
Subject: [PATCH 1/1] xfs: fix buffer flushing during log unmount
From: Amit Sahrawat <amit.sahrawat83@xxxxxxxxx>
Date: Wed, 15 Feb 2012 17:26:20 +0530
Cc: Nam-Jae Jeon <linkinjeon@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Amit Sahrawat <amit.sahrawat83@xxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=GVVra3B9avj5nP4HOMJfK0VtqowuX9o8/KLEVsDH/5A=; b=o5pv8erbVZ+30uVehm/2cKzZ32U//CSgQU5CDBiVZkAYePWbz0NLsUJ9yxUkSsI+sH UaMF0/plb5vsu3zdhxxKmP0hfNJzN6kEXnd57dyHWf53cXQgQmc57CZl2CpYPXdm3Qal WN6a5caNif4shrhCULoZQ2cYIzFnqciHhIC9I=
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@xxxxxxxxx>
Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>