From patchwork Thu Apr 18 08:10:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akira Fujita X-Patchwork-Id: 237475 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 8BEA42C0142 for ; Thu, 18 Apr 2013 18:17:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755510Ab3DRIRY (ORCPT ); Thu, 18 Apr 2013 04:17:24 -0400 Received: from TYO200.gate.nec.co.jp ([210.143.35.50]:65103 "EHLO tyo200.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755497Ab3DRIRX (ORCPT ); Thu, 18 Apr 2013 04:17:23 -0400 Received: from tyo201.gate.nec.co.jp ([10.7.69.201]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3I8HKlb012188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 18 Apr 2013 17:17:20 +0900 (JST) Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3I8BELt017461; Thu, 18 Apr 2013 17:11:14 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id r3I8BEF22678; Thu, 18 Apr 2013 17:11:14 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3I8BDJ0027684; Thu, 18 Apr 2013 17:11:14 +0900 (JST) Received: from chojiro.jp.nec.com ([10.26.220.28] [10.26.220.28]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-531971; Thu, 18 Apr 2013 17:10:38 +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-52847; Thu, 18 Apr 2013 17:10:38 +0900 Message-ID: <516FAA7E.3040604@rs.jp.nec.com> Date: Thu, 18 Apr 2013 17:10:38 +0900 From: Akira Fujita User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Theodore Tso CC: ext4 development Subject: [PATCH] tune2fs: Disallow tune2fs to set inode size larger than block size Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Disallow tune2fs command to set inode size larger than block size to ext3 and ext4 (^flex_bg). Without this patch, tune2fs makes FS unmountable. Steps to reproduce: 1.Create ext4 without flex_bg (or just create ext3) # mke2fs -t ext4 -O ^flex_bg DEV 2.Set inode size larger than block size # tune2fs -I 8192 DEV 3. We failed to mount FS # mount DEV MP mount: wrong fs type, bad option, bad superblock on /dev/sda7, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so Signed-off-by: Akira Fujita --- misc/tune2fs.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 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/tune2fs.c b/misc/tune2fs.c index c1ecae8..17e5335 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -2370,6 +2370,14 @@ retry_open: rc = 1; goto closefs; } + if ((new_inode_size > fs->blocksize) && + !(fs->super->s_feature_incompat & + EXT4_FEATURE_INCOMPAT_FLEX_BG)) { + fprintf(stderr, _("Invalid inode size %lu (max %d)\n"), + new_inode_size, fs->blocksize); + rc = 1; + goto closefs; + } /* * If inode resize is requested use the