Signed-off-by: Nick Piggin <npiggin@xxxxxxx> --- fs/inode.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) Index: linux-2.6/fs/inode.c =================================================================== --- linux-2.6.orig/fs/inode.c +++ linux-2.6/fs/inode.c @@ -603,27 +603,27 @@ static struct inode *find_inode(struct s struct inode *inode = NULL; repeat: - spin_lock_bucket(b); - hlist_bl_for_each_entry(inode, node, &b->head, i_hash) { + rcu_read_lock(); + hlist_bl_for_each_entry_rcu(inode, node, &b->head, i_hash) { if (inode->i_sb != sb) continue; - if (!spin_trylock(&inode->i_lock)) { - spin_unlock_bucket(b); - cpu_relax(); - goto repeat; + spin_lock(&inode->i_lock); + if (hlist_bl_unhashed(&inode->i_hash)) { + spin_unlock(&inode->i_lock); + continue; } if (!test(inode, data)) { spin_unlock(&inode->i_lock); continue; } if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) { - spin_unlock_bucket(b); + rcu_read_unlock(); __wait_on_freeing_inode(inode); goto repeat; } break; } - spin_unlock_bucket(b); + rcu_read_unlock(); return node ? inode : NULL; } @@ -639,25 +639,25 @@ static struct inode *find_inode_fast(str struct inode *inode = NULL; repeat: - spin_lock_bucket(b); - hlist_bl_for_each_entry(inode, node, &b->head, i_hash) { + rcu_read_lock(); + hlist_bl_for_each_entry_rcu(inode, node, &b->head, i_hash) { if (inode->i_ino != ino) continue; if (inode->i_sb != sb) continue; - if (!spin_trylock(&inode->i_lock)) { - spin_unlock_bucket(b); - cpu_relax(); - goto repeat; + spin_lock(&inode->i_lock); + if (hlist_bl_unhashed(&inode->i_hash)) { + spin_unlock(&inode->i_lock); + continue; } if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) { - spin_unlock_bucket(b); + rcu_read_unlock(); __wait_on_freeing_inode(inode); goto repeat; } break; } - spin_unlock_bucket(b); + rcu_read_unlock(); return node ? inode : NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html