xfs: Don't flush stale inodes
[safe/jmp/linux-2.6] / fs / xfs / xfs_inode.c
index ce278b3..391d36b 100644 (file)
@@ -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;
        }