[Top] [All Lists]

[PATCH 2/9] [PATCH 2/9] xfs: fix xfs_mark_inode_dirty during umount

To: stable@xxxxxxxxxxxxxxx
Subject: [PATCH 2/9] [PATCH 2/9] xfs: fix xfs_mark_inode_dirty during umount
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sat, 19 Nov 2011 13:13:38 -0500
Cc: xfs@xxxxxxxxxxx, Alex Elder <aelder@xxxxxxx>
References: <20111119181336.964593075@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
During umount we do not add a dirty inode to the lru and wait for it to
become clean first, but force writeback of data and metadata with
I_WILL_FREE set.  Currently there is no way for XFS to detect that the
inode has been redirtied for metadata operations, as we skip the
mark_inode_dirty call during teardown.  Fix this by setting i_update_core
nanually in that case, so that the inode gets flushed during inode reclaim.

Alternatively we could enable calling mark_inode_dirty for inodes in
I_WILL_FREE state, and let the VFS dirty tracking handle this.  I decided
against this as we will get better I/O patterns from reclaim compared to
the synchronous writeout in write_inode_now, and always marking the inode
dirty in some way from xfs_mark_inode_dirty is a better safetly net in
either case.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Alex Elder <aelder@xxxxxxx>
(cherry picked from commit da6742a5a4cc844a9982fdd936ddb537c0747856)

Signed-off-by: Alex Elder <aelder@xxxxxxx>
 fs/xfs/linux-2.6/xfs_iops.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index d44d92c..a9b3e1e 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -69,9 +69,8 @@ xfs_synchronize_times(
- * If the linux inode is valid, mark it dirty.
- * Used when committing a dirty inode into a transaction so that
- * the inode will get written back by the linux code
+ * If the linux inode is valid, mark it dirty, else mark the dirty state
+ * in the XFS inode to make sure we pick it up when reclaiming the inode.
@@ -81,6 +80,10 @@ xfs_mark_inode_dirty_sync(
        if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
+       else {
+               barrier();
+               ip->i_update_core = 1;
+       }
@@ -91,6 +94,11 @@ xfs_mark_inode_dirty(
        if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
+       else {
+               barrier();
+               ip->i_update_core = 1;
+       }

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