aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-07 03:15:37 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:27 -0500
commit1d1fe1ee02b9ac2660995b10e35dd41448fef011 (patch)
tree8961bbe5a36a07dc8ad8c6cd3e973ce0fcde5850 /fs/ext4/namei.c
parent473043dcee1874aab99f66b0362b344618eb3790 (diff)
iget: stop EXT4 from using iget() and read_inode()
Stop the EXT4 filesystem from using iget() and read_inode(). Replace ext4_read_inode() with ext4_iget(), and call that instead of iget(). ext4_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error. ext4_fill_super() returns any error incurred when getting the root inode instead of EINVAL. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Jan Kara <jack@suse.cz> Cc: <linux-ext4@vger.kernel.org> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 67b6d8a1ceff..d153bb5922fc 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1039,17 +1039,11 @@ static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, str
1039 if (!ext4_valid_inum(dir->i_sb, ino)) { 1039 if (!ext4_valid_inum(dir->i_sb, ino)) {
1040 ext4_error(dir->i_sb, "ext4_lookup", 1040 ext4_error(dir->i_sb, "ext4_lookup",
1041 "bad inode number: %lu", ino); 1041 "bad inode number: %lu", ino);
1042 inode = NULL; 1042 return ERR_PTR(-EIO);
1043 } else
1044 inode = iget(dir->i_sb, ino);
1045
1046 if (!inode)
1047 return ERR_PTR(-EACCES);
1048
1049 if (is_bad_inode(inode)) {
1050 iput(inode);
1051 return ERR_PTR(-ENOENT);
1052 } 1043 }
1044 inode = ext4_iget(dir->i_sb, ino);
1045 if (IS_ERR(inode))
1046 return ERR_CAST(inode);
1053 } 1047 }
1054 return d_splice_alias(inode, dentry); 1048 return d_splice_alias(inode, dentry);
1055} 1049}
@@ -1078,18 +1072,13 @@ struct dentry *ext4_get_parent(struct dentry *child)
1078 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { 1072 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) {
1079 ext4_error(child->d_inode->i_sb, "ext4_get_parent", 1073 ext4_error(child->d_inode->i_sb, "ext4_get_parent",
1080 "bad inode number: %lu", ino); 1074 "bad inode number: %lu", ino);
1081 inode = NULL; 1075 return ERR_PTR(-EIO);
1082 } else
1083 inode = iget(child->d_inode->i_sb, ino);
1084
1085 if (!inode)
1086 return ERR_PTR(-EACCES);
1087
1088 if (is_bad_inode(inode)) {
1089 iput(inode);
1090 return ERR_PTR(-ENOENT);
1091 } 1076 }
1092 1077
1078 inode = ext4_iget(child->d_inode->i_sb, ino);
1079 if (IS_ERR(inode))
1080 return ERR_CAST(inode);
1081
1093 parent = d_alloc_anon(inode); 1082 parent = d_alloc_anon(inode);
1094 if (!parent) { 1083 if (!parent) {
1095 iput(inode); 1084 iput(inode);