{
struct wrapfs_inode_info *info;
struct inode *inode; /* the new inode to return */
- int err;
+ if (!igrab(lower_inode))
+ return ERR_PTR(-ESTALE);
inode = iget5_locked(sb, /* our superblock */
/*
* hashval: we use inode number, but we can
wrapfs_inode_set, /* inode init function */
lower_inode); /* data passed to test+set fxns */
if (!inode) {
- err = -EACCES;
iput(lower_inode);
- return ERR_PTR(err);
+ return ERR_PTR(-ENOMEM);
}
- /* if found a cached inode, then just return it */
- if (!(inode->i_state & I_NEW))
+ /* if found a cached inode, then just return it (after iput) */
+ if (!(inode->i_state & I_NEW)) {
+ iput(lower_inode);
return inode;
+ }
/* initialize new inode */
info = WRAPFS_I(inode);
inode->i_ino = lower_inode->i_ino;
- if (!igrab(lower_inode)) {
- err = -ESTALE;
- return ERR_PTR(err);
- }
wrapfs_set_lower_inode(inode, lower_inode);
inode->i_version++;