Commit c0ef65d2 authored by Al Viro's avatar Al Viro

ufs_iget(): fail with -ESTALE on deleted inode

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 23ac7cba
...@@ -566,10 +566,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) ...@@ -566,10 +566,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
*/ */
inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode); inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode);
set_nlink(inode, fs16_to_cpu(sb, ufs_inode->ui_nlink)); set_nlink(inode, fs16_to_cpu(sb, ufs_inode->ui_nlink));
if (inode->i_nlink == 0) { if (inode->i_nlink == 0)
ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); return -ESTALE;
return -1;
}
/* /*
* Linux now has 32-bit uid and gid, so we can support EFT. * Linux now has 32-bit uid and gid, so we can support EFT.
...@@ -614,10 +612,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) ...@@ -614,10 +612,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
*/ */
inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode); inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode);
set_nlink(inode, fs16_to_cpu(sb, ufs2_inode->ui_nlink)); set_nlink(inode, fs16_to_cpu(sb, ufs2_inode->ui_nlink));
if (inode->i_nlink == 0) { if (inode->i_nlink == 0)
ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); return -ESTALE;
return -1;
}
/* /*
* Linux now has 32-bit uid and gid, so we can support EFT. * Linux now has 32-bit uid and gid, so we can support EFT.
...@@ -657,7 +653,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) ...@@ -657,7 +653,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
struct buffer_head * bh; struct buffer_head * bh;
struct inode *inode; struct inode *inode;
int err; int err = -EIO;
UFSD("ENTER, ino %lu\n", ino); UFSD("ENTER, ino %lu\n", ino);
...@@ -692,9 +688,10 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) ...@@ -692,9 +688,10 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
err = ufs1_read_inode(inode, err = ufs1_read_inode(inode,
ufs_inode + ufs_inotofsbo(inode->i_ino)); ufs_inode + ufs_inotofsbo(inode->i_ino));
} }
brelse(bh);
if (err) if (err)
goto bad_inode; goto bad_inode;
inode->i_version++; inode->i_version++;
ufsi->i_lastfrag = ufsi->i_lastfrag =
(inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
...@@ -703,15 +700,13 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) ...@@ -703,15 +700,13 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
ufs_set_inode_ops(inode); ufs_set_inode_ops(inode);
brelse(bh);
UFSD("EXIT\n"); UFSD("EXIT\n");
unlock_new_inode(inode); unlock_new_inode(inode);
return inode; return inode;
bad_inode: bad_inode:
iget_failed(inode); iget_failed(inode);
return ERR_PTR(-EIO); return ERR_PTR(err);
} }
static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment