From 19e66b5e1587e9a7f3a5952d256a1fc8ab07533f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 13 May 2009 19:13:40 +0100 Subject: [PATCH] --- yaml --- r: 145511 b: refs/heads/master c: 72a43d63cb51057393edfbcfc4596066205ad15d h: refs/heads/master i: 145509: 1cd4587e73071823dbec0abb2f65609fc2de343e 145507: c9d1e57e9036cd09128abc3078600a0f7af301fd 145503: d2264fc02e5a9a12420e93b4a9592b046b1c8ef9 v: v3 --- [refs] | 2 +- trunk/fs/inode.c | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 1ba15c18f923..3ddf835d4ef0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 460bcf57b128ce1c0dd553d905fedc097f9955c6 +refs/heads/master: 72a43d63cb51057393edfbcfc4596066205ad15d diff --git a/trunk/fs/inode.c b/trunk/fs/inode.c index 0571983755dc..a4876e561953 100644 --- a/trunk/fs/inode.c +++ b/trunk/fs/inode.c @@ -1053,13 +1053,22 @@ int insert_inode_locked(struct inode *inode) struct super_block *sb = inode->i_sb; ino_t ino = inode->i_ino; struct hlist_head *head = inode_hashtable + hash(sb, ino); - struct inode *old; inode->i_state |= I_LOCK|I_NEW; while (1) { + struct hlist_node *node; + struct inode *old = NULL; spin_lock(&inode_lock); - old = find_inode_fast(sb, head, ino); - if (likely(!old)) { + hlist_for_each_entry(old, node, head, i_hash) { + if (old->i_ino != ino) + continue; + if (old->i_sb != sb) + continue; + if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) + continue; + break; + } + if (likely(!node)) { hlist_add_head(&inode->i_hash, head); spin_unlock(&inode_lock); return 0; @@ -1081,14 +1090,24 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval, { struct super_block *sb = inode->i_sb; struct hlist_head *head = inode_hashtable + hash(sb, hashval); - struct inode *old; inode->i_state |= I_LOCK|I_NEW; while (1) { + struct hlist_node *node; + struct inode *old = NULL; + spin_lock(&inode_lock); - old = find_inode(sb, head, test, data); - if (likely(!old)) { + hlist_for_each_entry(old, node, head, i_hash) { + if (old->i_sb != sb) + continue; + if (!test(old, data)) + continue; + if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) + continue; + break; + } + if (likely(!node)) { hlist_add_head(&inode->i_hash, head); spin_unlock(&inode_lock); return 0;