+2005-11-09 Theodore Ts'o <tytso@mit.edu>
+
+ * Fix a bug when writing an external journal device on an big
+ endian machine (such as a S/390), where when the number of
+ block groups is zero, we never end up writing out the
+ primary superblock at all.
+
2005-09-24 Theodore Ts'o <tytso@mit.edu>
* ext2fs.h, bb_inode.c, closefs.c, initialize.c, mkdir.c,
group_shadow = fs->group_desc;
#endif
- /*
- * If this is an external journal device, don't write out the
- * block group descriptors or any of the backup superblocks
- */
- if (fs->super->s_feature_incompat &
- EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
- goto write_primary_superblock_only;
-
/*
* Set the state of the FS to be non-valid. (The state has
* already been backed up earlier, and will be restored after
}
#endif
+ /*
+ * If this is an external journal device, don't write out the
+ * block group descriptors or any of the backup superblocks
+ */
+ if (fs->super->s_feature_incompat &
+ EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
+ goto write_primary_superblock_only;
+
/*
* Write out the master group descriptors, and the backup
* superblocks and group descriptors.
goto errout;
}
}
- fs->super->s_block_group_nr = 0;
- fs->super->s_state = fs_state;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- *super_shadow = *fs->super;
- ext2fs_swap_super(super_shadow);
- }
-#endif
/*
* If the write_bitmaps() function is present, call it to
* out to disk first, just to avoid a race condition with an
* insy-tinsy window....
*/
+
+ fs->super->s_block_group_nr = 0;
+ fs->super->s_state = fs_state;
+#ifdef EXT2FS_ENABLE_SWAPFS
+ if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
+ *super_shadow = *fs->super;
+ ext2fs_swap_super(super_shadow);
+ }
+#endif
+
retval = io_channel_flush(fs->io);
retval = write_primary_superblock(fs, super_shadow);
if (retval)