Skip to content

Commit

Permalink
gfs2: gfs2_inode_lookup cleanup
Browse files Browse the repository at this point in the history
In gfs2_inode_lookup, once the inode has been looked up, we check if the
inode generation (no_formal_ino) is the one we're looking for.  If it
isn't and the inode wasn't in the inode cache, we discard the newly
looked up inode.  This is unnecessary, complicates the code, and makes
future changes to gfs2_inode_lookup harder, so change the code to retain
newly looked up inodes instead.

Signed-off-by: Andreas Gruenbacher <[email protected]>
  • Loading branch information
Andreas Gruenbacher committed Dec 2, 2021
1 parent e11b02d commit b8e12e3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,15 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
gfs2_glock_dq_uninit(&i_gh);

gfs2_set_iop(inode);
unlock_new_inode(inode);
}

if (no_formal_ino && ip->i_no_formal_ino &&
no_formal_ino != ip->i_no_formal_ino) {
error = -ESTALE;
if (inode->i_state & I_NEW)
goto fail;
iput(inode);
return ERR_PTR(error);
return ERR_PTR(-ESTALE);
}

if (inode->i_state & I_NEW)
unlock_new_inode(inode);

return inode;

fail:
Expand Down

0 comments on commit b8e12e3

Please sign in to comment.