@@ -3091,16 +3091,16 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,
30913091 inode = ilookup (sbi -> sb , rno );
30923092 if (inode ) {
30933093 mi = & ntfs_i (inode )-> mi ;
3094- } else if (op == InitializeFileRecordSegment ) {
3095- mi = kzalloc (sizeof (struct mft_inode ), GFP_NOFS );
3096- if (!mi )
3097- return - ENOMEM ;
3098- err = mi_format_new (mi , sbi , rno , 0 , false);
3099- if (err )
3100- goto out ;
31013094 } else {
31023095 /* Read from disk. */
31033096 err = mi_get (sbi , rno , & mi );
3097+ if (err && op == InitializeFileRecordSegment ) {
3098+ mi = kzalloc (sizeof (struct mft_inode ),
3099+ GFP_NOFS );
3100+ if (!mi )
3101+ return - ENOMEM ;
3102+ err = mi_format_new (mi , sbi , rno , 0 , false);
3103+ }
31043104 if (err )
31053105 return err ;
31063106 }
@@ -3109,15 +3109,13 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,
31093109 if (op == DeallocateFileRecordSegment )
31103110 goto skip_load_parent ;
31113111
3112- if (InitializeFileRecordSegment != op ) {
3113- if (rec -> rhdr .sign == NTFS_BAAD_SIGNATURE )
3114- goto dirty_vol ;
3115- if (!check_lsn (& rec -> rhdr , rlsn ))
3116- goto out ;
3117- if (!check_file_record (rec , NULL , sbi ))
3118- goto dirty_vol ;
3119- attr = Add2Ptr (rec , roff );
3120- }
3112+ if (rec -> rhdr .sign == NTFS_BAAD_SIGNATURE )
3113+ goto dirty_vol ;
3114+ if (!check_lsn (& rec -> rhdr , rlsn ))
3115+ goto out ;
3116+ if (!check_file_record (rec , NULL , sbi ))
3117+ goto dirty_vol ;
3118+ attr = Add2Ptr (rec , roff );
31213119
31223120 if (is_rec_base (rec ) || InitializeFileRecordSegment == op ) {
31233121 rno_base = rno ;
0 commit comments