+ fs->stride = fs->super->s_raid_stride;
+
+ /*
+ * If recovery is from backup superblock, Clear _UNININT flags &
+ * reset bg_itable_unused to zero
+ */
+ if (superblock > 1 && EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
+ dgrp_t group;
+
+ for (group = 0; group < fs->group_desc_count; group++) {
+ ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
+ ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT);
+ ext2fs_bg_itable_unused_set(fs, group, 0);
+ /* The checksum will be reset later, but fix it here
+ * anyway to avoid printing a lot of spurious errors. */
+ ext2fs_group_desc_csum_set(fs, group);
+ }
+ if (fs->flags & EXT2_FLAG_RW)
+ ext2fs_mark_super_dirty(fs);
+ }
+
+ if ((fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) &&
+ !(flags & EXT2_FLAG_SKIP_MMP) &&
+ (flags & (EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE))) {
+ retval = ext2fs_mmp_start(fs);
+ if (retval) {
+ fs->flags |= EXT2_FLAG_SKIP_MMP; /* just do cleanup */
+ ext2fs_mmp_stop(fs);
+ goto cleanup;
+ }
+ }
+
+ fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;