From fab0d286ec8539988551271c5faa864ea38dc4d4 Mon Sep 17 00:00:00 2001 From: Akira Fujita Date: Sun, 21 Apr 2013 23:14:28 -0400 Subject: [PATCH] tune2fs: disallow tune2fs to set inode size larger than block size Disallow tune2fs command to set the inode size to be larger than the block size. Without this patch, tune2fs makes the file system to be 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 Signed-off-by: "Theodore Ts'o" --- misc/tune2fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 849f3a0..47a7711 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -1944,6 +1944,12 @@ retry_open: rc = 1; goto closefs; } + if (new_inode_size > fs->blocksize) { + 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 -- 1.8.3.1