aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c89bb8797765..93beb865c20d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -777,11 +777,10 @@ static struct inode *ext4_nfs_get_inode(struct super_block *sb,
777 * Currently we don't know the generation for parent directory, so 777 * Currently we don't know the generation for parent directory, so
778 * a generation of 0 means "accept any" 778 * a generation of 0 means "accept any"
779 */ 779 */
780 inode = iget(sb, ino); 780 inode = ext4_iget(sb, ino);
781 if (inode == NULL) 781 if (IS_ERR(inode))
782 return ERR_PTR(-ENOMEM); 782 return ERR_CAST(inode);
783 if (is_bad_inode(inode) || 783 if (generation && inode->i_generation != generation) {
784 (generation && inode->i_generation != generation)) {
785 iput(inode); 784 iput(inode);
786 return ERR_PTR(-ESTALE); 785 return ERR_PTR(-ESTALE);
787 } 786 }
@@ -850,7 +849,6 @@ static struct quotactl_ops ext4_qctl_operations = {
850static const struct super_operations ext4_sops = { 849static const struct super_operations ext4_sops = {
851 .alloc_inode = ext4_alloc_inode, 850 .alloc_inode = ext4_alloc_inode,
852 .destroy_inode = ext4_destroy_inode, 851 .destroy_inode = ext4_destroy_inode,
853 .read_inode = ext4_read_inode,
854 .write_inode = ext4_write_inode, 852 .write_inode = ext4_write_inode,
855 .dirty_inode = ext4_dirty_inode, 853 .dirty_inode = ext4_dirty_inode,
856 .delete_inode = ext4_delete_inode, 854 .delete_inode = ext4_delete_inode,
@@ -1805,6 +1803,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1805 unsigned long journal_devnum = 0; 1803 unsigned long journal_devnum = 0;
1806 unsigned long def_mount_opts; 1804 unsigned long def_mount_opts;
1807 struct inode *root; 1805 struct inode *root;
1806 int ret = -EINVAL;
1808 int blocksize; 1807 int blocksize;
1809 int db_count; 1808 int db_count;
1810 int i; 1809 int i;
@@ -2237,19 +2236,24 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
2237 * so we can safely mount the rest of the filesystem now. 2236 * so we can safely mount the rest of the filesystem now.
2238 */ 2237 */
2239 2238
2240 root = iget(sb, EXT4_ROOT_INO); 2239 root = ext4_iget(sb, EXT4_ROOT_INO);
2241 sb->s_root = d_alloc_root(root); 2240 if (IS_ERR(root)) {
2242 if (!sb->s_root) {
2243 printk(KERN_ERR "EXT4-fs: get root inode failed\n"); 2241 printk(KERN_ERR "EXT4-fs: get root inode failed\n");
2244 iput(root); 2242 ret = PTR_ERR(root);
2245 goto failed_mount4; 2243 goto failed_mount4;
2246 } 2244 }
2247 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 2245 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
2248 dput(sb->s_root); 2246 iput(root);
2249 sb->s_root = NULL;
2250 printk(KERN_ERR "EXT4-fs: corrupt root inode, run e2fsck\n"); 2247 printk(KERN_ERR "EXT4-fs: corrupt root inode, run e2fsck\n");
2251 goto failed_mount4; 2248 goto failed_mount4;
2252 } 2249 }
2250 sb->s_root = d_alloc_root(root);
2251 if (!sb->s_root) {
2252 printk(KERN_ERR "EXT4-fs: get root dentry failed\n");
2253 iput(root);
2254 ret = -ENOMEM;
2255 goto failed_mount4;
2256 }
2253 2257
2254 ext4_setup_super (sb, es, sb->s_flags & MS_RDONLY); 2258 ext4_setup_super (sb, es, sb->s_flags & MS_RDONLY);
2255 2259
@@ -2330,7 +2334,7 @@ out_fail:
2330 sb->s_fs_info = NULL; 2334 sb->s_fs_info = NULL;
2331 kfree(sbi); 2335 kfree(sbi);
2332 lock_kernel(); 2336 lock_kernel();
2333 return -EINVAL; 2337 return ret;
2334} 2338}
2335 2339
2336/* 2340/*
@@ -2366,8 +2370,8 @@ static journal_t *ext4_get_journal(struct super_block *sb,
2366 * things happen if we iget() an unused inode, as the subsequent 2370 * things happen if we iget() an unused inode, as the subsequent
2367 * iput() will try to delete it. */ 2371 * iput() will try to delete it. */
2368 2372
2369 journal_inode = iget(sb, journal_inum); 2373 journal_inode = ext4_iget(sb, journal_inum);
2370 if (!journal_inode) { 2374 if (IS_ERR(journal_inode)) {
2371 printk(KERN_ERR "EXT4-fs: no journal found.\n"); 2375 printk(KERN_ERR "EXT4-fs: no journal found.\n");
2372 return NULL; 2376 return NULL;
2373 } 2377 }
@@ -2380,7 +2384,7 @@ static journal_t *ext4_get_journal(struct super_block *sb,
2380 2384
2381 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", 2385 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n",
2382 journal_inode, journal_inode->i_size); 2386 journal_inode, journal_inode->i_size);
2383 if (is_bad_inode(journal_inode) || !S_ISREG(journal_inode->i_mode)) { 2387 if (!S_ISREG(journal_inode->i_mode)) {
2384 printk(KERN_ERR "EXT4-fs: invalid journal inode.\n"); 2388 printk(KERN_ERR "EXT4-fs: invalid journal inode.\n");
2385 iput(journal_inode); 2389 iput(journal_inode);
2386 return NULL; 2390 return NULL;