@@ -989,28 +989,27 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
989989
990990 if (!ocfs2_parse_options (sb , data , & parsed_options , 0 )) {
991991 status = - EINVAL ;
992- goto read_super_error ;
992+ goto out ;
993993 }
994994
995995 /* probe for superblock */
996996 status = ocfs2_sb_probe (sb , & bh , & sector_size , & stats );
997997 if (status < 0 ) {
998998 mlog (ML_ERROR , "superblock probe failed!\n" );
999- goto read_super_error ;
999+ goto out ;
10001000 }
10011001
10021002 status = ocfs2_initialize_super (sb , bh , sector_size , & stats );
1003- osb = OCFS2_SB (sb );
1004- if (status < 0 ) {
1005- mlog_errno (status );
1006- goto read_super_error ;
1007- }
10081003 brelse (bh );
10091004 bh = NULL ;
1005+ if (status < 0 )
1006+ goto out ;
1007+
1008+ osb = OCFS2_SB (sb );
10101009
10111010 if (!ocfs2_check_set_options (sb , & parsed_options )) {
10121011 status = - EINVAL ;
1013- goto read_super_error ;
1012+ goto out_super ;
10141013 }
10151014 osb -> s_mount_opt = parsed_options .mount_opt ;
10161015 osb -> s_atime_quantum = parsed_options .atime_quantum ;
@@ -1027,7 +1026,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10271026
10281027 status = ocfs2_verify_userspace_stack (osb , & parsed_options );
10291028 if (status )
1030- goto read_super_error ;
1029+ goto out_super ;
10311030
10321031 sb -> s_magic = OCFS2_SUPER_MAGIC ;
10331032
@@ -1041,7 +1040,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10411040 status = - EACCES ;
10421041 mlog (ML_ERROR , "Readonly device detected but readonly "
10431042 "mount was not specified.\n" );
1044- goto read_super_error ;
1043+ goto out_super ;
10451044 }
10461045
10471046 /* You should not be able to start a local heartbeat
@@ -1050,7 +1049,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10501049 status = - EROFS ;
10511050 mlog (ML_ERROR , "Local heartbeat specified on readonly "
10521051 "device.\n" );
1053- goto read_super_error ;
1052+ goto out_super ;
10541053 }
10551054
10561055 status = ocfs2_check_journals_nolocks (osb );
@@ -1059,9 +1058,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10591058 mlog (ML_ERROR , "Recovery required on readonly "
10601059 "file system, but write access is "
10611060 "unavailable.\n" );
1062- else
1063- mlog_errno (status );
1064- goto read_super_error ;
1061+ goto out_super ;
10651062 }
10661063
10671064 ocfs2_set_ro_flag (osb , 1 );
@@ -1077,10 +1074,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10771074 }
10781075
10791076 status = ocfs2_verify_heartbeat (osb );
1080- if (status < 0 ) {
1081- mlog_errno (status );
1082- goto read_super_error ;
1083- }
1077+ if (status < 0 )
1078+ goto out_super ;
10841079
10851080 osb -> osb_debug_root = debugfs_create_dir (osb -> uuid_str ,
10861081 ocfs2_debugfs_root );
@@ -1094,23 +1089,22 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10941089
10951090 status = ocfs2_mount_volume (sb );
10961091 if (status < 0 )
1097- goto read_super_error ;
1092+ goto out_debugfs ;
10981093
10991094 if (osb -> root_inode )
11001095 inode = igrab (osb -> root_inode );
11011096
11021097 if (!inode ) {
11031098 status = - EIO ;
1104- mlog_errno (status );
1105- goto read_super_error ;
1099+ goto out_dismount ;
11061100 }
11071101
11081102 osb -> osb_dev_kset = kset_create_and_add (sb -> s_id , NULL ,
11091103 & ocfs2_kset -> kobj );
11101104 if (!osb -> osb_dev_kset ) {
11111105 status = - ENOMEM ;
11121106 mlog (ML_ERROR , "Unable to create device kset %s.\n" , sb -> s_id );
1113- goto read_super_error ;
1107+ goto out_dismount ;
11141108 }
11151109
11161110 /* Create filecheck sysfs related directories/files at
@@ -1119,14 +1113,13 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
11191113 status = - ENOMEM ;
11201114 mlog (ML_ERROR , "Unable to create filecheck sysfs directory at "
11211115 "/sys/fs/ocfs2/%s/filecheck.\n" , sb -> s_id );
1122- goto read_super_error ;
1116+ goto out_dismount ;
11231117 }
11241118
11251119 root = d_make_root (inode );
11261120 if (!root ) {
11271121 status = - ENOMEM ;
1128- mlog_errno (status );
1129- goto read_super_error ;
1122+ goto out_dismount ;
11301123 }
11311124
11321125 sb -> s_root = root ;
@@ -1178,17 +1171,21 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
11781171
11791172 return status ;
11801173
1181- read_super_error :
1182- brelse ( bh );
1183-
1184- if ( status )
1185- mlog_errno ( status ) ;
1174+ out_dismount :
1175+ atomic_set ( & osb -> vol_state , VOLUME_DISABLED );
1176+ wake_up ( & osb -> osb_mount_event );
1177+ ocfs2_dismount_volume ( sb , 1 );
1178+ goto out ;
11861179
1187- if (osb ) {
1188- atomic_set (& osb -> vol_state , VOLUME_DISABLED );
1189- wake_up (& osb -> osb_mount_event );
1190- ocfs2_dismount_volume (sb , 1 );
1191- }
1180+ out_debugfs :
1181+ debugfs_remove_recursive (osb -> osb_debug_root );
1182+ out_super :
1183+ ocfs2_release_system_inodes (osb );
1184+ kfree (osb -> recovery_map );
1185+ ocfs2_delete_osb (osb );
1186+ kfree (osb );
1187+ out :
1188+ mlog_errno (status );
11921189
11931190 return status ;
11941191}
0 commit comments