Skip to content

Commit

Permalink
jfs: switch to discard_new_inode()
Browse files Browse the repository at this point in the history
we don't want open-by-handle to pick an in-core inode that
has failed setup halfway through.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Aug 3, 2018
1 parent 2e5afe5 commit a6cbedf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions fs/jfs/jfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
inode = new_inode(sb);
if (!inode) {
jfs_warn("ialloc: new_inode returned NULL!");
rc = -ENOMEM;
goto fail;
return ERR_PTR(-ENOMEM);
}

jfs_inode = JFS_IP(inode);
Expand Down Expand Up @@ -141,9 +140,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
dquot_drop(inode);
inode->i_flags |= S_NOQUOTA;
clear_nlink(inode);
unlock_new_inode(inode);
discard_new_inode(inode);
return ERR_PTR(rc);

fail_put:
iput(inode);
fail:
return ERR_PTR(rc);
}
12 changes: 4 additions & 8 deletions fs/jfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
if (rc) {
free_ea_wmap(ip);
clear_nlink(ip);
unlock_new_inode(ip);
iput(ip);
discard_new_inode(ip);
} else {
d_instantiate_new(dentry, ip);
}
Expand Down Expand Up @@ -309,8 +308,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
if (rc) {
free_ea_wmap(ip);
clear_nlink(ip);
unlock_new_inode(ip);
iput(ip);
discard_new_inode(ip);
} else {
d_instantiate_new(dentry, ip);
}
Expand Down Expand Up @@ -1054,8 +1052,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
if (rc) {
free_ea_wmap(ip);
clear_nlink(ip);
unlock_new_inode(ip);
iput(ip);
discard_new_inode(ip);
} else {
d_instantiate_new(dentry, ip);
}
Expand Down Expand Up @@ -1441,8 +1438,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
if (rc) {
free_ea_wmap(ip);
clear_nlink(ip);
unlock_new_inode(ip);
iput(ip);
discard_new_inode(ip);
} else {
d_instantiate_new(dentry, ip);
}
Expand Down

0 comments on commit a6cbedf

Please sign in to comment.