aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/drop_caches.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index e2c6b6500c78..50f9087635d8 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -14,15 +14,21 @@ int sysctl_drop_caches;
14 14
15static void drop_pagecache_sb(struct super_block *sb) 15static void drop_pagecache_sb(struct super_block *sb)
16{ 16{
17 struct inode *inode; 17 struct inode *inode, *toput_inode = NULL;
18 18
19 spin_lock(&inode_lock); 19 spin_lock(&inode_lock);
20 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 20 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
21 if (inode->i_state & (I_FREEING|I_WILL_FREE)) 21 if (inode->i_state & (I_FREEING|I_WILL_FREE))
22 continue; 22 continue;
23 __iget(inode);
24 spin_unlock(&inode_lock);
23 __invalidate_mapping_pages(inode->i_mapping, 0, -1, true); 25 __invalidate_mapping_pages(inode->i_mapping, 0, -1, true);
26 iput(toput_inode);
27 toput_inode = inode;
28 spin_lock(&inode_lock);
24 } 29 }
25 spin_unlock(&inode_lock); 30 spin_unlock(&inode_lock);
31 iput(toput_inode);
26} 32}
27 33
28static void drop_pagecache(void) 34static void drop_pagecache(void)