Patchwork [1/2] e2fsprogs: fix data lost with mke2fs -S

mail settings
Submitter Akira Fujita
Date Dec. 22, 2011, 8:30 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/132784/
State Rejected
Headers show


Akira Fujita - Dec. 22, 2011, 8:30 a.m.
If we run the mke2fs with the -S option and the uninit_bg feature
simultaneously, the mke2fs marks blockgroups as uninitialized.
The e2fsck which run immediately after the mke2fs
removes all of the files.

To avoid this, the patch prohibits user from
setting the -S option and the uninit_bg feature simultaneously.

Usage example of the mke2fsk -S is as follows:

1. mke2fs -t ext4 -S -O ^uninit_bg DEV
2. tune2fs -O uninit_bg DEV 
3. e2fsck DEV

#2 is not necessary only if the uninit_bg feature is not set
to ext4 originally. 

Signed-off-by: Akira Fujita <>
 misc/mke2fs.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to
More majordomo info at


diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ef2531..19f3684 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1676,6 +1676,16 @@  profile_error:
        if (tmp)

+       if (super_only == 1 &&
+           EXT2_HAS_RO_COMPAT_FEATURE((&fs_param),
+                                       EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
+               fprintf(stderr, _("The -S option and the uninit_bg feature "
+                                 "are not compatible.\n"
+                                 "They can not be set both "
+                                 "simultaneously.\n"));
+               exit(1);
+       }
         * We now need to do a sanity check of fs_blocks_count for
         * 32-bit vs 64-bit block number support.