diff options
author | Nick Piggin <npiggin@suse.de> | 2010-01-29 15:38:27 -0800 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-04-27 17:32:41 +0200 |
commit | 81d2f3cb75bf112a21fad52e9d3e3a1d7d0c907d (patch) | |
tree | 47cf4bfd04753c26dadf15ab58e97ebcf302d390 /fs/drop_caches.c | |
parent | 97e747df2591f082b4a3964ac5ff784f0ff181f1 (diff) | |
download | lwn-81d2f3cb75bf112a21fad52e9d3e3a1d7d0c907d.tar.gz lwn-81d2f3cb75bf112a21fad52e9d3e3a1d7d0c907d.zip |
fs-inode_lock-scale-3
Protect i_state updates with i_lock
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/drop_caches.c')
-rw-r--r-- | fs/drop_caches.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/drop_caches.c b/fs/drop_caches.c index 8b6ef854aacc..16efb486c693 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c @@ -19,11 +19,14 @@ static void drop_pagecache_sb(struct super_block *sb) spin_lock(&inode_lock); spin_lock(&sb_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { - if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) - continue; - if (inode->i_mapping->nrpages == 0) + spin_lock(&inode->i_lock); + if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW) + || inode->i_mapping->nrpages == 0) { + spin_unlock(&inode->i_lock); continue; + } __iget(inode); + spin_unlock(&inode->i_lock); spin_unlock(&sb_inode_list_lock); spin_unlock(&inode_lock); invalidate_mapping_pages(inode->i_mapping, 0, -1); |