]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.12/xfs-reclaim-all-inodes-by-background-tree-walks.patch
fix up queue-5.15/mm-fix-race-between-__split_huge_pmd_locked-and-gup-.patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / xfs-reclaim-all-inodes-by-background-tree-walks.patch
CommitLineData
cc67517a
GKH
1From david@fromorbit.com Fri Apr 2 11:09:55 2010
2From: Dave Chinner <david@fromorbit.com>
3Date: Fri, 12 Mar 2010 09:42:10 +1100
4Subject: xfs: reclaim all inodes by background tree walks
5To: stable@kernel.org
6Cc: xfs@oss.sgi.com
7Message-ID: <1268347337-7160-13-git-send-email-david@fromorbit.com>
8
9From: Dave Chinner <david@fromorbit.com>
10
11commit 57817c68229984818fea9e614d6f95249c3fb098 upstream
12
13We cannot do direct inode reclaim without taking the flush lock to
14ensure that we do not reclaim an inode under IO. We check the inode
15is clean before doing direct reclaim, but this is not good enough
16because the inode flush code marks the inode clean once it has
17copied the in-core dirty state to the backing buffer.
18
19It is the flush lock that determines whether the inode is still
20under IO, even though it is marked clean, and the inode is still
21required at IO completion so we can't reclaim it even though it is
22clean in core. Hence the requirement that we need to take the flush
23lock even on clean inodes because this guarantees that the inode
24writeback IO has completed and it is safe to reclaim the inode.
25
26With delayed write inode flushing, we could end up waiting a long
27time on the flush lock even for a clean inode. The background
28reclaim already handles this efficiently, so avoid all the problems
29by killing the direct reclaim path altogether.
30
31Signed-off-by: Dave Chinner <david@fromorbit.com>
32Reviewed-by: Christoph Hellwig <hch@lst.de>
33Signed-off-by: Alex Elder <aelder@sgi.com>
34Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
35
36---
37 fs/xfs/linux-2.6/xfs_super.c | 14 ++++++--------
38 1 file changed, 6 insertions(+), 8 deletions(-)
39
40--- a/fs/xfs/linux-2.6/xfs_super.c
41+++ b/fs/xfs/linux-2.6/xfs_super.c
42@@ -953,16 +953,14 @@ xfs_fs_destroy_inode(
43 ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIM));
44
45 /*
46- * If we have nothing to flush with this inode then complete the
47- * teardown now, otherwise delay the flush operation.
48+ * We always use background reclaim here because even if the
49+ * inode is clean, it still may be under IO and hence we have
50+ * to take the flush lock. The background reclaim path handles
51+ * this more efficiently than we can here, so simply let background
52+ * reclaim tear down all inodes.
53 */
54- if (!xfs_inode_clean(ip)) {
55- xfs_inode_set_reclaim_tag(ip);
56- return;
57- }
58-
59 out_reclaim:
60- xfs_ireclaim(ip);
61+ xfs_inode_set_reclaim_tag(ip);
62 }
63
64 /*