Skip to contentSkip to conversation

tune2fs: Don't allow tune2fs -I if flex_bg on

PATCH New Peng Tao 1 participant 2 messages Dec 10, 2008 – Dec 11, 2008

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

PATCH 3/3 tune2fs: Don't allow tune2fs -I if flex_bg on

add force flag to tune2fs -I, because it may cause data corruption
when the
last inode table block is followed by a in-use data block. If user
really want to
tune the inode size, they should be warned about this.

misc/tune2fs.c +8 -1
index 453a529..1227802 100644
@@ -107,7 +107,7 @@ static void usage(void)
 		  "[-L volume_label]\n"
 		  "\t[-M last_mounted_dir] [-O [^]feature[,...]]\n"
 		  "\t[-E extended-option[,...]] [-T last_check_time] "
-		  "[-U UUID]\n\t[ -I new_inode_size ] device\n"), program_name);
+		  "[-U UUID]\n\t[ -I new_inode_size ] [-f] device\n"), program_name);
 	exit (1);
 }
 
@@ -1598,6 +1598,13 @@ retry_open:
 		ext2fs_mark_super_dirty(fs);
 	}
 	if (I_flag) {
+		if (!f_flag) {
+			fputs(_("Enlarging inode size may cause data "
+				"corruption.\nUse with -f at your warranty. "
+				"Abort.\n"), stderr);
+			exit(1);
+		}
+
 		if (mount_flags & EXT2_MF_MOUNTED) {
 			fputs(_("The inode size may only be "
 				"changed when the filesystem is "
author
#1 lore raw

PATCH RESEND 1/1 tune2fs: add force flag to tune2fs -I

Sorry, just found out that I messed up this patch...
----------------------------------------

add force flag to tune2fs -I, because it may cause data corruption when the last inode table block is followed by a in-use data block. If user really want to tune the inode size, they should be warned about this.

---
 misc/tune2fs.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
misc/tune2fs.c +6 -0
index 453a529..7308773 100644
@@ -1598,6 +1598,12 @@ retry_open:
 		ext2fs_mark_super_dirty(fs);
 	}
 	if (I_flag) {
+		if (f_flag) {
+			fputs(_("Enlarging inode size may cause data "
+				"corruption.\nUse with -f at your warranty. "
+				"Abort.\n"), stderr);
+			exit(1);
+		}
 		if (mount_flags & EXT2_MF_MOUNTED) {
 			fputs(_("The inode size may only be "
 				"changed when the filesystem is "