mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amit Sahrawat <amit.sahrawat83@gmail.com>
To: Ben Myers <bpm@sgi.com>, Alex Elder <elder@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	xfs-masters@oss.sgi.com, xfs@oss.sgi.com
Cc: Nam-Jae Jeon <linkinjeon@gmail.com>,
	linux-kernel@vger.kernel.org,
	Amit Sahrawat <amit.sahrawat83@gmail.com>
Subject: [PATCH 1/1] xfs: fix buffer flushing during log unmount
Date: Wed, 15 Feb 2012 17:26:20 +0530	[thread overview]
Message-ID: <1329306980-17997-1-git-send-email-amit.sahrawat83@gmail.com> (raw)

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


             reply	other threads:[~2012-02-15 11:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 11:56 Amit Sahrawat [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329306980-17997-1-git-send-email-amit.sahrawat83@gmail.com \
    --to=amit.sahrawat83@gmail.com \
    --cc=bpm@sgi.com \
    --cc=david@fromorbit.com \
    --cc=elder@kernel.org \
    --cc=hch@infradead.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®