hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/ext4/ialloc.c
....@@ -82,11 +82,16 @@
8282 struct buffer_head *bh)
8383 {
8484 ext4_fsblk_t blk;
85
- struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
85
+ struct ext4_group_info *grp;
86
+
87
+ if (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)
88
+ return 0;
89
+
90
+ grp = ext4_get_group_info(sb, block_group);
8691
8792 if (buffer_verified(bh))
8893 return 0;
89
- if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
94
+ if (!grp || EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
9095 return -EFSCORRUPTED;
9196
9297 ext4_lock_group(sb, block_group);
....@@ -94,7 +99,8 @@
9499 goto verified;
95100 blk = ext4_inode_bitmap(sb, desc);
96101 if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
97
- EXT4_INODES_PER_GROUP(sb) / 8)) {
102
+ EXT4_INODES_PER_GROUP(sb) / 8) ||
103
+ ext4_simulate_fail(sb, EXT4_SIM_IBITMAP_CRC)) {
98104 ext4_unlock_group(sb, block_group);
99105 ext4_error(sb, "Corrupt inode bitmap - block_group = %u, "
100106 "inode_bitmap = %llu", block_group, blk);
....@@ -112,7 +118,7 @@
112118 * Read the inode allocation bitmap for a given block_group, reading
113119 * into the specified slot in the superblock's bitmap cache.
114120 *
115
- * Return buffer_head of bitmap on success or NULL.
121
+ * Return buffer_head of bitmap on success, or an ERR_PTR on error.
116122 */
117123 static struct buffer_head *
118124 ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
....@@ -188,15 +194,13 @@
188194 * submit the buffer_head for reading
189195 */
190196 trace_ext4_load_inode_bitmap(sb, block_group);
191
- bh->b_end_io = ext4_end_bitmap_read;
192
- get_bh(bh);
193
- submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
194
- wait_on_buffer(bh);
197
+ ext4_read_bh(bh, REQ_META | REQ_PRIO, ext4_end_bitmap_read);
198
+ ext4_simulate_fail_bh(sb, bh, EXT4_SIM_IBITMAP_EIO);
195199 if (!buffer_uptodate(bh)) {
196200 put_bh(bh);
197
- ext4_error(sb, "Cannot read inode bitmap - "
198
- "block_group = %u, inode_bitmap = %llu",
199
- block_group, bitmap_blk);
201
+ ext4_error_err(sb, EIO, "Cannot read inode bitmap - "
202
+ "block_group = %u, inode_bitmap = %llu",
203
+ block_group, bitmap_blk);
200204 ext4_mark_group_bitmap_corrupted(sb, block_group,
201205 EXT4_GROUP_INFO_IBITMAP_CORRUPT);
202206 return ERR_PTR(-EIO);
....@@ -265,13 +269,8 @@
265269 ext4_debug("freeing inode %lu\n", ino);
266270 trace_ext4_free_inode(inode);
267271
268
- /*
269
- * Note: we must free any quota before locking the superblock,
270
- * as writing the quota to disk may need the lock as well.
271
- */
272272 dquot_initialize(inode);
273273 dquot_free_inode(inode);
274
- dquot_drop(inode);
275274
276275 is_directory = S_ISDIR(inode->i_mode);
277276
....@@ -287,15 +286,17 @@
287286 bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
288287 bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
289288 /* Don't bother if the inode bitmap is corrupt. */
290
- grp = ext4_get_group_info(sb, block_group);
291289 if (IS_ERR(bitmap_bh)) {
292290 fatal = PTR_ERR(bitmap_bh);
293291 bitmap_bh = NULL;
294292 goto error_return;
295293 }
296
- if (unlikely(EXT4_MB_GRP_IBITMAP_CORRUPT(grp))) {
297
- fatal = -EFSCORRUPTED;
298
- goto error_return;
294
+ if (!(sbi->s_mount_state & EXT4_FC_REPLAY)) {
295
+ grp = ext4_get_group_info(sb, block_group);
296
+ if (!grp || unlikely(EXT4_MB_GRP_IBITMAP_CORRUPT(grp))) {
297
+ fatal = -EFSCORRUPTED;
298
+ goto error_return;
299
+ }
299300 }
300301
301302 BUFFER_TRACE(bitmap_bh, "get_write_access");
....@@ -321,14 +322,16 @@
321322 if (is_directory) {
322323 count = ext4_used_dirs_count(sb, gdp) - 1;
323324 ext4_used_dirs_set(sb, gdp, count);
324
- percpu_counter_dec(&sbi->s_dirs_counter);
325
+ if (percpu_counter_initialized(&sbi->s_dirs_counter))
326
+ percpu_counter_dec(&sbi->s_dirs_counter);
325327 }
326328 ext4_inode_bitmap_csum_set(sb, block_group, gdp, bitmap_bh,
327329 EXT4_INODES_PER_GROUP(sb) / 8);
328330 ext4_group_desc_csum_set(sb, block_group, gdp);
329331 ext4_unlock_group(sb, block_group);
330332
331
- percpu_counter_inc(&sbi->s_freeinodes_counter);
333
+ if (percpu_counter_initialized(&sbi->s_freeinodes_counter))
334
+ percpu_counter_inc(&sbi->s_freeinodes_counter);
332335 if (sbi->s_log_groups_per_flex) {
333336 struct flex_groups *fg;
334337
....@@ -508,7 +511,7 @@
508511 goto fallback;
509512 }
510513
511
- max_dirs = ndirs / ngroups + inodes_per_group / 16;
514
+ max_dirs = ndirs / ngroups + inodes_per_group*flex_size / 16;
512515 min_inodes = avefreei - inodes_per_group*flex_size / 4;
513516 if (min_inodes < 1)
514517 min_inodes = 1;
....@@ -716,22 +719,198 @@
716719 static int find_inode_bit(struct super_block *sb, ext4_group_t group,
717720 struct buffer_head *bitmap, unsigned long *ino)
718721 {
722
+ bool check_recently_deleted = EXT4_SB(sb)->s_journal == NULL;
723
+ unsigned long recently_deleted_ino = EXT4_INODES_PER_GROUP(sb);
724
+
719725 next:
720726 *ino = ext4_find_next_zero_bit((unsigned long *)
721727 bitmap->b_data,
722728 EXT4_INODES_PER_GROUP(sb), *ino);
723729 if (*ino >= EXT4_INODES_PER_GROUP(sb))
724
- return 0;
730
+ goto not_found;
725731
726
- if ((EXT4_SB(sb)->s_journal == NULL) &&
727
- recently_deleted(sb, group, *ino)) {
732
+ if (check_recently_deleted && recently_deleted(sb, group, *ino)) {
733
+ recently_deleted_ino = *ino;
728734 *ino = *ino + 1;
729735 if (*ino < EXT4_INODES_PER_GROUP(sb))
730736 goto next;
737
+ goto not_found;
738
+ }
739
+ return 1;
740
+not_found:
741
+ if (recently_deleted_ino >= EXT4_INODES_PER_GROUP(sb))
731742 return 0;
743
+ /*
744
+ * Not reusing recently deleted inodes is mostly a preference. We don't
745
+ * want to report ENOSPC or skew allocation patterns because of that.
746
+ * So return even recently deleted inode if we could find better in the
747
+ * given range.
748
+ */
749
+ *ino = recently_deleted_ino;
750
+ return 1;
751
+}
752
+
753
+int ext4_mark_inode_used(struct super_block *sb, int ino)
754
+{
755
+ unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count);
756
+ struct buffer_head *inode_bitmap_bh = NULL, *group_desc_bh = NULL;
757
+ struct ext4_group_desc *gdp;
758
+ ext4_group_t group;
759
+ int bit;
760
+ int err = -EFSCORRUPTED;
761
+
762
+ if (ino < EXT4_FIRST_INO(sb) || ino > max_ino)
763
+ goto out;
764
+
765
+ group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
766
+ bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
767
+ inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
768
+ if (IS_ERR(inode_bitmap_bh))
769
+ return PTR_ERR(inode_bitmap_bh);
770
+
771
+ if (ext4_test_bit(bit, inode_bitmap_bh->b_data)) {
772
+ err = 0;
773
+ goto out;
732774 }
733775
734
- return 1;
776
+ gdp = ext4_get_group_desc(sb, group, &group_desc_bh);
777
+ if (!gdp || !group_desc_bh) {
778
+ err = -EINVAL;
779
+ goto out;
780
+ }
781
+
782
+ ext4_set_bit(bit, inode_bitmap_bh->b_data);
783
+
784
+ BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
785
+ err = ext4_handle_dirty_metadata(NULL, NULL, inode_bitmap_bh);
786
+ if (err) {
787
+ ext4_std_error(sb, err);
788
+ goto out;
789
+ }
790
+ err = sync_dirty_buffer(inode_bitmap_bh);
791
+ if (err) {
792
+ ext4_std_error(sb, err);
793
+ goto out;
794
+ }
795
+
796
+ /* We may have to initialize the block bitmap if it isn't already */
797
+ if (ext4_has_group_desc_csum(sb) &&
798
+ gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
799
+ struct buffer_head *block_bitmap_bh;
800
+
801
+ block_bitmap_bh = ext4_read_block_bitmap(sb, group);
802
+ if (IS_ERR(block_bitmap_bh)) {
803
+ err = PTR_ERR(block_bitmap_bh);
804
+ goto out;
805
+ }
806
+
807
+ BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap");
808
+ err = ext4_handle_dirty_metadata(NULL, NULL, block_bitmap_bh);
809
+ sync_dirty_buffer(block_bitmap_bh);
810
+
811
+ /* recheck and clear flag under lock if we still need to */
812
+ ext4_lock_group(sb, group);
813
+ if (ext4_has_group_desc_csum(sb) &&
814
+ (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) {
815
+ gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
816
+ ext4_free_group_clusters_set(sb, gdp,
817
+ ext4_free_clusters_after_init(sb, group, gdp));
818
+ ext4_block_bitmap_csum_set(sb, group, gdp,
819
+ block_bitmap_bh);
820
+ ext4_group_desc_csum_set(sb, group, gdp);
821
+ }
822
+ ext4_unlock_group(sb, group);
823
+ brelse(block_bitmap_bh);
824
+
825
+ if (err) {
826
+ ext4_std_error(sb, err);
827
+ goto out;
828
+ }
829
+ }
830
+
831
+ /* Update the relevant bg descriptor fields */
832
+ if (ext4_has_group_desc_csum(sb)) {
833
+ int free;
834
+
835
+ ext4_lock_group(sb, group); /* while we modify the bg desc */
836
+ free = EXT4_INODES_PER_GROUP(sb) -
837
+ ext4_itable_unused_count(sb, gdp);
838
+ if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
839
+ gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT);
840
+ free = 0;
841
+ }
842
+
843
+ /*
844
+ * Check the relative inode number against the last used
845
+ * relative inode number in this group. if it is greater
846
+ * we need to update the bg_itable_unused count
847
+ */
848
+ if (bit >= free)
849
+ ext4_itable_unused_set(sb, gdp,
850
+ (EXT4_INODES_PER_GROUP(sb) - bit - 1));
851
+ } else {
852
+ ext4_lock_group(sb, group);
853
+ }
854
+
855
+ ext4_free_inodes_set(sb, gdp, ext4_free_inodes_count(sb, gdp) - 1);
856
+ if (ext4_has_group_desc_csum(sb)) {
857
+ ext4_inode_bitmap_csum_set(sb, group, gdp, inode_bitmap_bh,
858
+ EXT4_INODES_PER_GROUP(sb) / 8);
859
+ ext4_group_desc_csum_set(sb, group, gdp);
860
+ }
861
+
862
+ ext4_unlock_group(sb, group);
863
+ err = ext4_handle_dirty_metadata(NULL, NULL, group_desc_bh);
864
+ sync_dirty_buffer(group_desc_bh);
865
+out:
866
+ return err;
867
+}
868
+
869
+static int ext4_xattr_credits_for_new_inode(struct inode *dir, mode_t mode,
870
+ bool encrypt)
871
+{
872
+ struct super_block *sb = dir->i_sb;
873
+ int nblocks = 0;
874
+#ifdef CONFIG_EXT4_FS_POSIX_ACL
875
+ struct posix_acl *p = get_acl(dir, ACL_TYPE_DEFAULT);
876
+
877
+ if (IS_ERR(p))
878
+ return PTR_ERR(p);
879
+ if (p) {
880
+ int acl_size = p->a_count * sizeof(ext4_acl_entry);
881
+
882
+ nblocks += (S_ISDIR(mode) ? 2 : 1) *
883
+ __ext4_xattr_set_credits(sb, NULL /* inode */,
884
+ NULL /* block_bh */, acl_size,
885
+ true /* is_create */);
886
+ posix_acl_release(p);
887
+ }
888
+#endif
889
+
890
+#ifdef CONFIG_SECURITY
891
+ {
892
+ int num_security_xattrs = 1;
893
+
894
+#ifdef CONFIG_INTEGRITY
895
+ num_security_xattrs++;
896
+#endif
897
+ /*
898
+ * We assume that security xattrs are never more than 1k.
899
+ * In practice they are under 128 bytes.
900
+ */
901
+ nblocks += num_security_xattrs *
902
+ __ext4_xattr_set_credits(sb, NULL /* inode */,
903
+ NULL /* block_bh */, 1024,
904
+ true /* is_create */);
905
+ }
906
+#endif
907
+ if (encrypt)
908
+ nblocks += __ext4_xattr_set_credits(sb,
909
+ NULL /* inode */,
910
+ NULL /* block_bh */,
911
+ FSCRYPT_SET_CONTEXT_MAX_SIZE,
912
+ true /* is_create */);
913
+ return nblocks;
735914 }
736915
737916 /*
....@@ -763,8 +942,8 @@
763942 struct inode *ret;
764943 ext4_group_t i;
765944 ext4_group_t flex_group;
766
- struct ext4_group_info *grp;
767
- int encrypt = 0;
945
+ struct ext4_group_info *grp = NULL;
946
+ bool encrypt = false;
768947
769948 /* Cannot create files in a deleted directory */
770949 if (!dir || !dir->i_nlink)
....@@ -775,59 +954,6 @@
775954
776955 if (unlikely(ext4_forced_shutdown(sbi)))
777956 return ERR_PTR(-EIO);
778
-
779
- if ((IS_ENCRYPTED(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) &&
780
- (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) &&
781
- !(i_flags & EXT4_EA_INODE_FL)) {
782
- err = fscrypt_get_encryption_info(dir);
783
- if (err)
784
- return ERR_PTR(err);
785
- if (!fscrypt_has_encryption_key(dir))
786
- return ERR_PTR(-ENOKEY);
787
- encrypt = 1;
788
- }
789
-
790
- if (!handle && sbi->s_journal && !(i_flags & EXT4_EA_INODE_FL)) {
791
-#ifdef CONFIG_EXT4_FS_POSIX_ACL
792
- struct posix_acl *p = get_acl(dir, ACL_TYPE_DEFAULT);
793
-
794
- if (IS_ERR(p))
795
- return ERR_CAST(p);
796
- if (p) {
797
- int acl_size = p->a_count * sizeof(ext4_acl_entry);
798
-
799
- nblocks += (S_ISDIR(mode) ? 2 : 1) *
800
- __ext4_xattr_set_credits(sb, NULL /* inode */,
801
- NULL /* block_bh */, acl_size,
802
- true /* is_create */);
803
- posix_acl_release(p);
804
- }
805
-#endif
806
-
807
-#ifdef CONFIG_SECURITY
808
- {
809
- int num_security_xattrs = 1;
810
-
811
-#ifdef CONFIG_INTEGRITY
812
- num_security_xattrs++;
813
-#endif
814
- /*
815
- * We assume that security xattrs are never
816
- * more than 1k. In practice they are under
817
- * 128 bytes.
818
- */
819
- nblocks += num_security_xattrs *
820
- __ext4_xattr_set_credits(sb, NULL /* inode */,
821
- NULL /* block_bh */, 1024,
822
- true /* is_create */);
823
- }
824
-#endif
825
- if (encrypt)
826
- nblocks += __ext4_xattr_set_credits(sb,
827
- NULL /* inode */, NULL /* block_bh */,
828
- FSCRYPT_SET_CONTEXT_MAX_SIZE,
829
- true /* is_create */);
830
- }
831957
832958 ngroups = ext4_get_groups_count(sb);
833959 trace_ext4_request_inode(dir, mode);
....@@ -858,9 +984,24 @@
858984 else
859985 ei->i_projid = make_kprojid(&init_user_ns, EXT4_DEF_PROJID);
860986
987
+ if (!(i_flags & EXT4_EA_INODE_FL)) {
988
+ err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
989
+ if (err)
990
+ goto out;
991
+ }
992
+
861993 err = dquot_initialize(inode);
862994 if (err)
863995 goto out;
996
+
997
+ if (!handle && sbi->s_journal && !(i_flags & EXT4_EA_INODE_FL)) {
998
+ ret2 = ext4_xattr_credits_for_new_inode(dir, mode, encrypt);
999
+ if (ret2 < 0) {
1000
+ err = ret2;
1001
+ goto out;
1002
+ }
1003
+ nblocks += ret2;
1004
+ }
8641005
8651006 if (!goal)
8661007 goal = sbi->s_inode_goal;
....@@ -901,15 +1042,21 @@
9011042 if (ext4_free_inodes_count(sb, gdp) == 0)
9021043 goto next_group;
9031044
904
- grp = ext4_get_group_info(sb, group);
905
- /* Skip groups with already-known suspicious inode tables */
906
- if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
907
- goto next_group;
1045
+ if (!(sbi->s_mount_state & EXT4_FC_REPLAY)) {
1046
+ grp = ext4_get_group_info(sb, group);
1047
+ /*
1048
+ * Skip groups with already-known suspicious inode
1049
+ * tables
1050
+ */
1051
+ if (!grp || EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
1052
+ goto next_group;
1053
+ }
9081054
9091055 brelse(inode_bitmap_bh);
9101056 inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
9111057 /* Skip groups with suspicious inode tables */
912
- if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) ||
1058
+ if (((!(sbi->s_mount_state & EXT4_FC_REPLAY))
1059
+ && EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) ||
9131060 IS_ERR(inode_bitmap_bh)) {
9141061 inode_bitmap_bh = NULL;
9151062 goto next_group;
....@@ -928,11 +1075,11 @@
9281075 goto next_group;
9291076 }
9301077
931
- if (!handle) {
1078
+ if ((!(sbi->s_mount_state & EXT4_FC_REPLAY)) && !handle) {
9321079 BUG_ON(nblocks <= 0);
9331080 handle = __ext4_journal_start_sb(dir->i_sb, line_no,
934
- handle_type, nblocks,
935
- 0);
1081
+ handle_type, nblocks, 0,
1082
+ ext4_trans_default_revoke_credits(sb));
9361083 if (IS_ERR(handle)) {
9371084 err = PTR_ERR(handle);
9381085 ext4_std_error(sb, err);
....@@ -1032,9 +1179,19 @@
10321179 /* Update the relevant bg descriptor fields */
10331180 if (ext4_has_group_desc_csum(sb)) {
10341181 int free;
1035
- struct ext4_group_info *grp = ext4_get_group_info(sb, group);
1182
+ struct ext4_group_info *grp = NULL;
10361183
1037
- down_read(&grp->alloc_sem); /* protect vs itable lazyinit */
1184
+ if (!(sbi->s_mount_state & EXT4_FC_REPLAY)) {
1185
+ grp = ext4_get_group_info(sb, group);
1186
+ if (!grp) {
1187
+ err = -EFSCORRUPTED;
1188
+ goto out;
1189
+ }
1190
+ down_read(&grp->alloc_sem); /*
1191
+ * protect vs itable
1192
+ * lazyinit
1193
+ */
1194
+ }
10381195 ext4_lock_group(sb, group); /* while we modify the bg desc */
10391196 free = EXT4_INODES_PER_GROUP(sb) -
10401197 ext4_itable_unused_count(sb, gdp);
....@@ -1050,7 +1207,8 @@
10501207 if (ino > free)
10511208 ext4_itable_unused_set(sb, gdp,
10521209 (EXT4_INODES_PER_GROUP(sb) - ino));
1053
- up_read(&grp->alloc_sem);
1210
+ if (!(sbi->s_mount_state & EXT4_FC_REPLAY))
1211
+ up_read(&grp->alloc_sem);
10541212 } else {
10551213 ext4_lock_group(sb, group);
10561214 }
....@@ -1108,7 +1266,7 @@
11081266 ei->i_block_group = group;
11091267 ei->i_last_alloc_group = ~0;
11101268
1111
- ext4_set_inode_flags(inode);
1269
+ ext4_set_inode_flags(inode, true);
11121270 if (IS_DIRSYNC(inode))
11131271 ext4_handle_sync(handle);
11141272 if (insert_inode_locked(inode) < 0) {
....@@ -1141,7 +1299,8 @@
11411299
11421300 ei->i_extra_isize = sbi->s_want_extra_isize;
11431301 ei->i_inline_off = 0;
1144
- if (ext4_has_feature_inline_data(sb))
1302
+ if (ext4_has_feature_inline_data(sb) &&
1303
+ (!(ei->i_flags & EXT4_DAX_FL) || S_ISDIR(mode)))
11451304 ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
11461305 ret = inode;
11471306 err = dquot_alloc_inode(inode);
....@@ -1154,7 +1313,7 @@
11541313 * prevent its deduplication.
11551314 */
11561315 if (encrypt) {
1157
- err = fscrypt_inherit_context(dir, inode, handle, true);
1316
+ err = fscrypt_set_context(inode, handle);
11581317 if (err)
11591318 goto fail_free_drop;
11601319 }
....@@ -1223,7 +1382,7 @@
12231382 bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
12241383 bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
12251384 if (IS_ERR(bitmap_bh))
1226
- return (struct inode *) bitmap_bh;
1385
+ return ERR_CAST(bitmap_bh);
12271386
12281387 /* Having the inode bit set should be a 100% indicator that this
12291388 * is a valid orphan (no e2fsck run on fs). Orphans also include
....@@ -1235,8 +1394,10 @@
12351394 inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL);
12361395 if (IS_ERR(inode)) {
12371396 err = PTR_ERR(inode);
1238
- ext4_error(sb, "couldn't read orphan inode %lu (err %d)",
1239
- ino, err);
1397
+ ext4_error_err(sb, -err,
1398
+ "couldn't read orphan inode %lu (err %d)",
1399
+ ino, err);
1400
+ brelse(bitmap_bh);
12401401 return inode;
12411402 }
12421403
....@@ -1369,7 +1530,7 @@
13691530 }
13701531
13711532 gdp = ext4_get_group_desc(sb, group, &group_desc_bh);
1372
- if (!gdp)
1533
+ if (!gdp || !grp)
13731534 goto out;
13741535
13751536 /*
....@@ -1447,7 +1608,7 @@
14471608 if (ret < 0)
14481609 goto err_out;
14491610 if (barrier)
1450
- blkdev_issue_flush(sb->s_bdev, GFP_NOFS, NULL);
1611
+ blkdev_issue_flush(sb->s_bdev, GFP_NOFS);
14511612
14521613 skip_zeroout:
14531614 ext4_lock_group(sb, group);