Skip to contentSkip to conversation

fs: inode: fix icache pruning locked inode spin protection

PATCH New Johannes Weiner 1 participant 1 message Feb 1, 2013 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: inode: fix icache pruning locked inode spin protection

Inodes are added to the head of the superblock LRU list and reclaimed from the tail. If trylocking an inode during reclaim fails, it has to be moved to the head of the list, not the tail, to prevent spinning on it.

---
 fs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/inode.c +2 -2
index 14084b7..852bcbf 100644
@@ -722,10 +722,10 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
 		/*
 		 * we are inverting the sb->s_inode_lru_lock/inode->i_lock here,
 		 * so use a trylock. If we fail to get the lock, just move the
-		 * inode to the back of the list so we don't spin on it.
+		 * inode to the other end of the list so we don't spin on it.
 		 */
 		if (!spin_trylock(&inode->i_lock)) {
-			list_move_tail(&inode->i_lru, &sb->s_inode_lru);
+			list_move(&inode->i_lru, &sb->s_inode_lru);
 			continue;
 		}
 
Signature · 1 line
1.7.11.7