public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] make inode reclaim synchronise with xfs_iflush_done()
@ 2008-02-07  4:19 Lachlan McIlroy
  2008-02-07  7:20 ` David Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Lachlan McIlroy @ 2008-02-07  4:19 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

On a forced shutdown, xfs_finish_reclaim() will skip flushing the inode.
If the inode flush lock is not already held and there is an outstanding
xfs_iflush_done() then we might free the inode prematurely.  By acquiring
and releasing the flush lock we will synchronise with xfs_iflush_done().

Lachlan

--- fs/xfs/xfs_vnodeops.c_1.727	2008-01-10 16:00:48.000000000 +1100
+++ fs/xfs/xfs_vnodeops.c	2008-02-07 15:15:26.000000000 +1100
@@ -3721,12 +3721,12 @@ xfs_finish_reclaim(
  	 * We get the flush lock regardless, though, just to make sure
  	 * we don't free it while it is being flushed.
  	 */
-	if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-		if (!locked) {
-			xfs_ilock(ip, XFS_ILOCK_EXCL);
-			xfs_iflock(ip);
-		}
+	if (!locked) {
+		xfs_ilock(ip, XFS_ILOCK_EXCL);
+		xfs_iflock(ip);
+	}

+	if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
  		if (ip->i_update_core ||
  		    ((ip->i_itemp != NULL) &&
  		     (ip->i_itemp->ili_format.ilf_fields != 0))) {
@@ -3746,17 +3746,11 @@ xfs_finish_reclaim(
  		ASSERT(ip->i_update_core == 0);
  		ASSERT(ip->i_itemp == NULL ||
  		       ip->i_itemp->ili_format.ilf_fields == 0);
-		xfs_iunlock(ip, XFS_ILOCK_EXCL);
-	} else if (locked) {
-		/*
-		 * We are not interested in doing an iflush if we're
-		 * in the process of shutting down the filesystem forcibly.
-		 * So, just reclaim the inode.
-		 */
-		xfs_ifunlock(ip);
-		xfs_iunlock(ip, XFS_ILOCK_EXCL);
  	}

+	xfs_ifunlock(ip);
+	xfs_iunlock(ip, XFS_ILOCK_EXCL);
+
   reclaim:
  	xfs_ireclaim(ip);
  	return 0;

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

* Re: [PATCH V2] make inode reclaim synchronise with xfs_iflush_done()
  2008-02-07  4:19 [PATCH V2] make inode reclaim synchronise with xfs_iflush_done() Lachlan McIlroy
@ 2008-02-07  7:20 ` David Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: David Chinner @ 2008-02-07  7:20 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs-dev, xfs-oss

On Thu, Feb 07, 2008 at 03:19:49PM +1100, Lachlan McIlroy wrote:
> On a forced shutdown, xfs_finish_reclaim() will skip flushing the inode.
> If the inode flush lock is not already held and there is an outstanding
> xfs_iflush_done() then we might free the inode prematurely.  By acquiring
> and releasing the flush lock we will synchronise with xfs_iflush_done().

Looks fine.

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

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

end of thread, other threads:[~2008-02-07  7:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07  4:19 [PATCH V2] make inode reclaim synchronise with xfs_iflush_done() Lachlan McIlroy
2008-02-07  7:20 ` David Chinner

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