From patchwork Thu Dec 22 08:30:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akira Fujita X-Patchwork-Id: 132784 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6A60BB714E for ; Thu, 22 Dec 2011 19:31:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753416Ab1LVIbl (ORCPT ); Thu, 22 Dec 2011 03:31:41 -0500 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:42764 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753215Ab1LVIbl (ORCPT ); Thu, 22 Dec 2011 03:31:41 -0500 Received: from mailgate3.nec.co.jp ([10.7.69.197]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id pBM8VXE4006060; Thu, 22 Dec 2011 17:31:33 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id pBM8VWs09377; Thu, 22 Dec 2011 17:31:32 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv.nec.co.jp (8.13.8/8.13.4) with ESMTP id pBM8VWHQ002387; Thu, 22 Dec 2011 17:31:32 +0900 (JST) Received: from chojiro.jp.nec.com ([10.26.220.28] [10.26.220.28]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-60376; Thu, 22 Dec 2011 17:30:27 +0900 Received: from [10.64.168.93] ([10.64.168.93] [10.64.168.93]) by mail.jp.nec.com with ESMTPA id BT-MMP-63498; Thu, 22 Dec 2011 17:30:23 +0900 Message-ID: <4EF2EA9E.9080500@rs.jp.nec.com> Date: Thu, 22 Dec 2011 17:30:22 +0900 From: Akira Fujita User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 ThunderBrowse/3.8 MIME-Version: 1.0 To: Theodore Tso , ext4 development Subject: [PATCH 1/2] e2fsprogs: fix data lost with mke2fs -S Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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.