]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.12/xfs-avoid-inodes-in-reclaim-when-flushing-from-inode-cache.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / xfs-avoid-inodes-in-reclaim-when-flushing-from-inode-cache.patch
1 From david@fromorbit.com Fri Apr 2 11:09:28 2010
2 From: Dave Chinner <david@fromorbit.com>
3 Date: Fri, 12 Mar 2010 09:42:09 +1100
4 Subject: xfs: Avoid inodes in reclaim when flushing from inode cache
5 To: stable@kernel.org
6 Cc: xfs@oss.sgi.com
7 Message-ID: <1268347337-7160-12-git-send-email-david@fromorbit.com>
8
9 From: Dave Chinner <david@fromorbit.com>
10
11 commit 018027be90a6946e8cf3f9b17b5582384f7ed117 upstream
12
13 The reclaim code will handle flushing of dirty inodes before reclaim
14 occurs, so avoid them when determining whether an inode is a
15 candidate for flushing to disk when walking the radix trees. This
16 is based on a test patch from Christoph Hellwig.
17
18 Signed-off-by: Dave Chinner <david@fromorbit.com>
19 Reviewed-by: Christoph Hellwig <hch@lst.de>
20 Signed-off-by: Alex Elder <aelder@sgi.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22
23 ---
24 fs/xfs/linux-2.6/xfs_sync.c | 31 ++++++++++++++++++-------------
25 1 file changed, 18 insertions(+), 13 deletions(-)
26
27 --- a/fs/xfs/linux-2.6/xfs_sync.c
28 +++ b/fs/xfs/linux-2.6/xfs_sync.c
29 @@ -179,26 +179,31 @@ xfs_sync_inode_valid(
30 struct xfs_perag *pag)
31 {
32 struct inode *inode = VFS_I(ip);
33 + int error = EFSCORRUPTED;
34
35 /* nothing to sync during shutdown */
36 - if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
37 - read_unlock(&pag->pag_ici_lock);
38 - return EFSCORRUPTED;
39 - }
40 + if (XFS_FORCED_SHUTDOWN(ip->i_mount))
41 + goto out_unlock;
42
43 - /* If we can't get a reference on the inode, it must be in reclaim. */
44 - if (!igrab(inode)) {
45 - read_unlock(&pag->pag_ici_lock);
46 - return ENOENT;
47 - }
48 - read_unlock(&pag->pag_ici_lock);
49 + /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
50 + error = ENOENT;
51 + if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
52 + goto out_unlock;
53
54 - if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) {
55 + /* If we can't grab the inode, it must on it's way to reclaim. */
56 + if (!igrab(inode))
57 + goto out_unlock;
58 +
59 + if (is_bad_inode(inode)) {
60 IRELE(ip);
61 - return ENOENT;
62 + goto out_unlock;
63 }
64
65 - return 0;
66 + /* inode is valid */
67 + error = 0;
68 +out_unlock:
69 + read_unlock(&pag->pag_ici_lock);
70 + return error;
71 }
72
73 STATIC int