On Tue, Aug 26, 2025 at 11:39:26AM -0400, Josef Bacik wrote: > Follow the same pattern in find_inode*. Instead of checking for > I_WILL_FREE|I_FREEING simply call igrab() and if it succeeds we're done. > > Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx> > --- > fs/inode.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/fs/inode.c b/fs/inode.c > index 8ae9ed9605ef..d34da95a3295 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -1883,11 +1883,8 @@ int insert_inode_locked(struct inode *inode) > continue; > if (old->i_sb != sb) > continue; > - spin_lock(&old->i_lock); > - if (old->i_state & (I_FREEING|I_WILL_FREE)) { > - spin_unlock(&old->i_lock); > + if (!igrab(old)) > continue; > - } > break; > } > if (likely(!old)) { > @@ -1899,12 +1896,13 @@ int insert_inode_locked(struct inode *inode) > spin_unlock(&inode_hash_lock); > return 0; > } > + spin_lock(&old->i_lock); > if (unlikely(old->i_state & I_CREATING)) { > spin_unlock(&old->i_lock); > spin_unlock(&inode_hash_lock); > + iput(old); > return -EBUSY; > } > - __iget(old); > spin_unlock(&old->i_lock); > spin_unlock(&inode_hash_lock); > wait_on_inode(old); > -- > 2.49.0 > So looking at the function in full context: 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); while (1) { struct inode *old = NULL; spin_lock(&inode_hash_lock); hlist_for_each_entry(old, head, i_hash) { if (old->i_ino != ino) continue; if (old->i_sb != sb) continue; if (!igrab(old)) continue; break; } if (likely(!old)) { spin_lock(&inode->i_lock); iobj_get(inode); Sorry, this is probably me being confused. Say we allocated a new inode then we've definitely went through inode_init_always() and so i_obj_count == i_count == 1. Then we insert it into the hash table. For that we only take an i_obj_count but no i_count bringing it to 2. So for the hashlist we only deal with i_obj_count. Is that documented somewhere? I probably just read over it.