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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <a-fujita@xxxxxxxxxxxxx>
---
 misc/mke2fs.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

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)
                free(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.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux