Commit 866e4ed7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

xfs: fix xfs_mark_inode_dirty during umount

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
(cherry picked from commit da6742a5a4cc844a9982fdd936ddb537c0747856)
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 242d6219
...@@ -70,9 +70,8 @@ xfs_synchronize_times( ...@@ -70,9 +70,8 @@ xfs_synchronize_times(
} }
/* /*
* If the linux inode is valid, mark it dirty. * If the linux inode is valid, mark it dirty, else mark the dirty state
* Used when committing a dirty inode into a transaction so that * in the XFS inode to make sure we pick it up when reclaiming the inode.
* the inode will get written back by the linux code
*/ */
void void
xfs_mark_inode_dirty_sync( xfs_mark_inode_dirty_sync(
...@@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync( ...@@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync(
if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
mark_inode_dirty_sync(inode); mark_inode_dirty_sync(inode);
else {
barrier();
ip->i_update_core = 1;
}
} }
void void
...@@ -92,6 +95,11 @@ xfs_mark_inode_dirty( ...@@ -92,6 +95,11 @@ xfs_mark_inode_dirty(
if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
mark_inode_dirty(inode); mark_inode_dirty(inode);
else {
barrier();
ip->i_update_core = 1;
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment