aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r--fs/ext3/super.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 343677e8c350..cf2a2c3660ec 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -649,11 +649,10 @@ static struct inode *ext3_nfs_get_inode(struct super_block *sb,
649 * Currently we don't know the generation for parent directory, so 649 * Currently we don't know the generation for parent directory, so
650 * a generation of 0 means "accept any" 650 * a generation of 0 means "accept any"
651 */ 651 */
652 inode = iget(sb, ino); 652 inode = ext3_iget(sb, ino);
653 if (inode == NULL) 653 if (IS_ERR(inode))
654 return ERR_PTR(-ENOMEM); 654 return ERR_CAST(inode);
655 if (is_bad_inode(inode) || 655 if (generation && inode->i_generation != generation) {
656 (generation && inode->i_generation != generation)) {
657 iput(inode); 656 iput(inode);
658 return ERR_PTR(-ESTALE); 657 return ERR_PTR(-ESTALE);
659 } 658 }
@@ -722,7 +721,6 @@ static struct quotactl_ops ext3_qctl_operations = {
722static const struct super_operations ext3_sops = { 721static const struct super_operations ext3_sops = {
723 .alloc_inode = ext3_alloc_inode, 722 .alloc_inode = ext3_alloc_inode,
724 .destroy_inode = ext3_destroy_inode, 723 .destroy_inode = ext3_destroy_inode,
725 .read_inode = ext3_read_inode,
726 .write_inode = ext3_write_inode, 724 .write_inode = ext3_write_inode,
727 .dirty_inode = ext3_dirty_inode, 725 .dirty_inode = ext3_dirty_inode,
728 .delete_inode = ext3_delete_inode, 726 .delete_inode = ext3_delete_inode,
@@ -1378,8 +1376,8 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1378 while (es->s_last_orphan) { 1376 while (es->s_last_orphan) {
1379 struct inode *inode; 1377 struct inode *inode;
1380 1378
1381 if (!(inode = 1379 inode = ext3_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
1382 ext3_orphan_get(sb, le32_to_cpu(es->s_last_orphan)))) { 1380 if (IS_ERR(inode)) {
1383 es->s_last_orphan = 0; 1381 es->s_last_orphan = 0;
1384 break; 1382 break;
1385 } 1383 }
@@ -1508,6 +1506,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1508 int db_count; 1506 int db_count;
1509 int i; 1507 int i;
1510 int needs_recovery; 1508 int needs_recovery;
1509 int ret = -EINVAL;
1511 __le32 features; 1510 __le32 features;
1512 int err; 1511 int err;
1513 1512
@@ -1877,19 +1876,24 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1877 * so we can safely mount the rest of the filesystem now. 1876 * so we can safely mount the rest of the filesystem now.
1878 */ 1877 */
1879 1878
1880 root = iget(sb, EXT3_ROOT_INO); 1879 root = ext3_iget(sb, EXT3_ROOT_INO);
1881 sb->s_root = d_alloc_root(root); 1880 if (IS_ERR(root)) {
1882 if (!sb->s_root) {
1883 printk(KERN_ERR "EXT3-fs: get root inode failed\n"); 1881 printk(KERN_ERR "EXT3-fs: get root inode failed\n");
1884 iput(root); 1882 ret = PTR_ERR(root);
1885 goto failed_mount4; 1883 goto failed_mount4;
1886 } 1884 }
1887 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 1885 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
1888 dput(sb->s_root); 1886 iput(root);
1889 sb->s_root = NULL;
1890 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); 1887 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n");
1891 goto failed_mount4; 1888 goto failed_mount4;
1892 } 1889 }
1890 sb->s_root = d_alloc_root(root);
1891 if (!sb->s_root) {
1892 printk(KERN_ERR "EXT3-fs: get root dentry failed\n");
1893 iput(root);
1894 ret = -ENOMEM;
1895 goto failed_mount4;
1896 }
1893 1897
1894 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); 1898 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
1895 /* 1899 /*
@@ -1941,7 +1945,7 @@ out_fail:
1941 sb->s_fs_info = NULL; 1945 sb->s_fs_info = NULL;
1942 kfree(sbi); 1946 kfree(sbi);
1943 lock_kernel(); 1947 lock_kernel();
1944 return -EINVAL; 1948 return ret;
1945} 1949}
1946 1950
1947/* 1951/*
@@ -1977,8 +1981,8 @@ static journal_t *ext3_get_journal(struct super_block *sb,
1977 * things happen if we iget() an unused inode, as the subsequent 1981 * things happen if we iget() an unused inode, as the subsequent
1978 * iput() will try to delete it. */ 1982 * iput() will try to delete it. */
1979 1983
1980 journal_inode = iget(sb, journal_inum); 1984 journal_inode = ext3_iget(sb, journal_inum);
1981 if (!journal_inode) { 1985 if (IS_ERR(journal_inode)) {
1982 printk(KERN_ERR "EXT3-fs: no journal found.\n"); 1986 printk(KERN_ERR "EXT3-fs: no journal found.\n");
1983 return NULL; 1987 return NULL;
1984 } 1988 }
@@ -1991,7 +1995,7 @@ static journal_t *ext3_get_journal(struct super_block *sb,
1991 1995
1992 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", 1996 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n",
1993 journal_inode, journal_inode->i_size); 1997 journal_inode, journal_inode->i_size);
1994 if (is_bad_inode(journal_inode) || !S_ISREG(journal_inode->i_mode)) { 1998 if (!S_ISREG(journal_inode->i_mode)) {
1995 printk(KERN_ERR "EXT3-fs: invalid journal inode.\n"); 1999 printk(KERN_ERR "EXT3-fs: invalid journal inode.\n");
1996 iput(journal_inode); 2000 iput(journal_inode);
1997 return NULL; 2001 return NULL;