Skip to content

Commit

Permalink
xfs: Don't flush stale inodes
Browse files Browse the repository at this point in the history
Because inodes remain in cache much longer than inode buffers do
under memory pressure, we can get the situation where we have
stale, dirty inodes being reclaimed but the backing storage has
been freed.  Hence we should never, ever flush XFS_ISTALE inodes
to disk as there is no guarantee that the backing buffer is in
cache and still marked stale when the flush occurs.

Signed-off-by: Dave Chinner <[email protected]>
Signed-off-by: Alex Elder <[email protected]>
  • Loading branch information
dchinner authored and Alex Elder committed Jan 10, 2010
1 parent d6d59ba commit 44e08c4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2841,10 +2841,14 @@ xfs_iflush(
mp = ip->i_mount;

/*
* If the inode isn't dirty, then just release the inode
* flush lock and do nothing.
* If the inode isn't dirty, then just release the inode flush lock and
* do nothing. Treat stale inodes the same; we cannot rely on the
* backing buffer remaining stale in cache for the remaining life of
* the stale inode and so xfs_itobp() below may give us a buffer that
* no longer contains inodes below. Doing this stale check here also
* avoids forcing the log on pinned, stale inodes.
*/
if (xfs_inode_clean(ip)) {
if (xfs_inode_clean(ip) || xfs_iflags_test(ip, XFS_ISTALE)) {
xfs_ifunlock(ip);
return 0;
}
Expand Down

0 comments on commit 44e08c4

Please sign in to comment.