Skip to contentSkip to conversation

mke2fs.conf: remove legacy entry for ext4dev

PATCH In review Theodore Ts'o 2 participants 6 messages Aug 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 mke2fs.conf: remove legacy entry for ext4dev

---
 misc/mke2fs.conf.in  | 5 -----
 tests/mke2fs.conf.in | 5 -----
 2 files changed, 10 deletions(-)
misc/mke2fs.conf.in +0 -5
index 812f7c742..d0066b78b 100644
@@ -14,11 +14,6 @@
 		features = has_journal,extent,huge_file,flex_bg,uninit_bg,64bit,dir_nlink,extra_isize
 		inode_size = 256
 	}
-	ext4dev = {
-		features = has_journal,extent,huge_file,flex_bg,uninit_bg,inline_data,64bit,dir_nlink,extra_isize
-		inode_size = 256
-		options = test_fs=1
-	}
 	small = {
 		blocksize = 1024
 		inode_size = 128
tests/mke2fs.conf.in +0 -5
index c06050d8d..ee246ba8b 100644
@@ -17,11 +17,6 @@
 		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
 		inode_size = 256
 	}
-	ext4dev = {
-		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
-		inode_size = 256
-		options = test_fs=1
-	}
 	small = {
 		blocksize = 1024
 		inode_size = 128
Signature · 1 line
2.11.0.rc0.7.gbe5a750
#1 lore raw

PATCH 2/5 mke2fs: automatically use 256 byte inodes if project feature enabled

If the inode size is not implicitly requested on the command line, and it is too small to support the project feature, automatically promote the inode size to be 256 bytes so that the project feature will work.

Note the previous test to check for a too-small inode size didn't work because it checked before inode size was set in fs_param. Hence, it was possible to create file systems with a 128 byte inode and the project feature enabled.

---
 misc/mke2fs.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
misc/mke2fs.c +20 -12
index b8d078a0a..7fd7fae40 100644
@@ -2319,6 +2319,26 @@ profile_error:
 			(unsigned long long) fs_blocks_count);
 	}
 
+	if (quotatype_bits & QUOTA_PRJ_BIT)
+		ext2fs_set_feature_project(&fs_param);
+
+	if (ext2fs_has_feature_project(&fs_param)) {
+		quotatype_bits |= QUOTA_PRJ_BIT;
+		if (inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
+			com_err(program_name, 0,
+				_("%d byte inodes are too small for "
+				  "project quota"),
+				inode_size);
+			exit(1);
+		}
+		if (inode_size == 0) {
+			inode_size = get_int_from_profile(fs_types,
+							  "inode_size", 0);
+			if (inode_size <= EXT2_GOOD_OLD_INODE_SIZE*2)
+				inode_size = EXT2_GOOD_OLD_INODE_SIZE*2;
+		}
+	}
+
 	/* Don't allow user to set both metadata_csum and uninit_bg bits. */
 	if (ext2fs_has_feature_metadata_csum(&fs_param) &&
 	    ext2fs_has_feature_gdt_csum(&fs_param))
@@ -2419,19 +2439,6 @@ profile_error:
 		exit(1);
 	}
 
-	/*
-	 * If inode size is 128 and project quota is enabled, we need
-	 * to notify users that project ID will never be useful.
-	 */
-	if (ext2fs_has_feature_project(&fs_param) &&
-	    fs_param.s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
-		com_err(program_name, 0,
-			_("%d byte inodes are too small for project quota; "
-			  "specify larger size"),
-			fs_param.s_inode_size);
-		exit(1);
-	}
#2 lore raw

PATCH 3/5 tune2fs: do not enable project feature or quota if inode size is 128 bytes

In reply to Theodore Ts'o

Don't allow the user to enable the project feature (or project quota) if the inode size is 128 bytes.

---
 misc/tune2fs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
misc/tune2fs.c +12 -0
index 85435674d..99c17cc47 100644
@@ -1310,6 +1310,11 @@ mmp_error:
 
 	if (FEATURE_ON(E2P_FEATURE_RO_INCOMPAT,
 		       EXT4_FEATURE_RO_COMPAT_PROJECT)) {
+		if (fs->super->s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
+			fprintf(stderr, _("Cannot enable project feature; "
+					  "inode size too small.\n"));
+			exit(1);
+		}
 		Q_flag = 1;
 		quota_enable[PRJQUOTA] = QOPT_ENABLE;
 	}
@@ -1497,6 +1502,13 @@ static void handle_quota_options(ext2_filsys fs)
 		/* Nothing to do. */
 		return;
 
+	if (quota_enable[PRJQUOTA] == QOPT_ENABLE &&
+	    fs->super->s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
+		fprintf(stderr, _("Cannot enable project quota; "
+				  "inode size too small.\n"));
+		exit(1);
+	}
+
 	for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
 		if (quota_enable[qtype] == QOPT_ENABLE)
 			qtype_bits |= 1 << qtype;
Signature · 1 line
2.11.0.rc0.7.gbe5a750
#3 lore raw

PATCH 4/5 tune2fs: explain why an fsck is needed

In reply to Theodore Ts'o

Currently tune2fs just says without any explanation, "run fsck -f". Add a short explanation that a freshly checked file system is required to reduce user confusion. (We could add even more details, but hopefully this is enough.)

Addresses-Debian-Bug: #857336

---
 misc/tune2fs.c                     | 8 ++++++--
 tests/t_dangerous/expect           | 4 ++++
 tests/t_enable_mcsum/expect        | 2 ++
 tests/t_enable_mcsum_initbg/expect | 2 ++
 tests/t_iexpand_mcsum/expect       | 2 ++
 5 files changed, 16 insertions(+), 2 deletions(-)
misc/tune2fs.c +6 -2
index 99c17cc47..3e7ca23e1 100644
@@ -116,6 +116,8 @@ struct blk_move {
 
 errcode_t ext2fs_run_ext3_journal(ext2_filsys *fs);
 
+static const char *fsck_explain = N_("\nThis operation requires a freshly checked filesystem.\n");
+
 static const char *please_fsck = N_("Please run e2fsck -f on the filesystem.\n");
 static const char *please_dir_fsck =
 		N_("Please run e2fsck -fD on the filesystem.\n");
@@ -419,7 +421,8 @@ static void check_fsck_needed(ext2_filsys fs, const char *prompt)
 	if (!(fs->super->s_state & EXT2_VALID_FS) ||
 	    (fs->super->s_state & EXT2_ERROR_FS) ||
 	    (fs->super->s_lastcheck < fs->super->s_mtime)) {
-		printf("\n%s\n", _(please_fsck));
+		puts(_(fsck_explain));
+		puts(_(please_fsck));
 		if (mount_flags & EXT2_MF_READONLY)
 			printf("%s", _("(and reboot afterwards!)\n"));
 		exit(1);
@@ -441,7 +444,8 @@ static void request_dir_fsck_afterwards(ext2_filsys fs)
 		return;
 	fsck_requested++;
 	fs->super->s_state &= ~EXT2_VALID_FS;
-	printf("\n%s\n", _(please_dir_fsck));
+	puts(_(fsck_explain));
+	puts(_(please_dir_fsck));
 	if (mount_flags & EXT2_MF_READONLY)
 		printf("%s", _("(and reboot afterwards!)\n"));
 }
tests/t_dangerous/expect +4 -0
index bae7e0e6e..3bae8fafd 100644
@@ -11,6 +11,8 @@ Writing superblocks and filesystem accounting information:      done
 
 tune2fs -O metadata_csum test.img
 
+This operation requires a freshly checked filesystem.
+
 Please run e2fsck -f on the filesystem.
 
 Exit status is 1
@@ -57,6 +59,8 @@ Exit status is 0
 tune2fs -O metadata_csum test.img
 Enabling checksums could take some time.
 Proceed anyway (or wait 5 seconds) ? (y,N) 
+This operation requires a freshly checked filesystem.
+
 Please run e2fsck -fD on the filesystem.
 
 Exit status is 0
tests/t_enable_mcsum/expect +2 -0
index 5a1a33a50..c8a2674bf 100644
@@ -18,6 +18,8 @@ Pass 5: Checking group summary information
 Exit status is 0
 tune2fs -O metadata_csum test.img
 
+This operation requires a freshly checked filesystem.
+
 Please run e2fsck -fD on the filesystem.
 
 Exit status is 0
tests/t_enable_mcsum_initbg/expect +2 -0
index ed4774c2d..e05dd6031 100644
@@ -18,6 +18,8 @@ Pass 5: Checking group summary information
 Exit status is 0
 tune2fs -O metadata_csum test.img
 
+This operation requires a freshly checked filesystem.
+
 Please run e2fsck -fD on the filesystem.
 
 Exit status is 0
tests/t_iexpand_mcsum/expect +2 -0
index 0ebf1626d..772bd6238 100644
@@ -19,6 +19,8 @@ Exit status is 0
 tune2fs -I 256 -O metadata_csum test.img
 Setting inode size 256
 
+This operation requires a freshly checked filesystem.
+
 Please run e2fsck -fD on the filesystem.
 
 Exit status is 0
Signature · 1 line
2.11.0.rc0.7.gbe5a750
#4 lore raw

PATCH 5/5 tune2fs, mke2fs: clarify proceed delay question

In reply to Theodore Ts'o

The explanation of the what happens after delaying N seconds is ambiguous. Clarify what happens.

Addresses-Debian-Bug: #857336

---
 misc/util.c              |  2 +-
 tests/t_dangerous/expect | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
misc/util.c +1 -1
index 0ff3d4967..1d33883d4 100644
@@ -101,7 +101,7 @@ void proceed_question(int delay)
 			return;
 		}
 		signal(SIGALRM, alarm_signal);
-		printf(_("Proceed anyway (or wait %d seconds) ? (y,N) "),
+		printf(_("Proceed anyway (or wait %d seconds to proceed) ? (y,N) "),
 		       delay);
 		alarm(delay);
 	} else
tests/t_dangerous/expect +6 -6
index 3bae8fafd..a9903b750 100644
@@ -37,15 +37,15 @@ Pass 5: Checking group summary information
 Exit status is 0
 tune2fs -O metadata_csum test.img
 Enabling checksums could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) 
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) 
 Exit status is 1
 tune2fs -I 512 test.img
 Resizing inodes could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) 
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) 
 Exit status is 1
 tune2fs -U random test.img
 Setting UUID on a checksummed filesystem could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) 
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) 
 Exit status is 1
 
 Change in FS metadata:
@@ -58,7 +58,7 @@ Pass 5: Checking group summary information
 Exit status is 0
 tune2fs -O metadata_csum test.img
 Enabling checksums could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) 
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) 
 This operation requires a freshly checked filesystem.
 
 Please run e2fsck -fD on the filesystem.
@@ -76,11 +76,11 @@ Pass 5: Checking group summary information
 
 tune2fs -I 512 test.img
 Resizing inodes could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) Setting inode size 512
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) Setting inode size 512
 Exit status is 0
 tune2fs -U f0f0f0f0-f0f0-f0f0-f0f0-f0f0f0f0f0f0 test.img
 Setting UUID on a checksummed filesystem could take some time.
-Proceed anyway (or wait 5 seconds) ? (y,N) Exit status is 0
+Proceed anyway (or wait 5 seconds to proceed) ? (y,N) Exit status is 0
 Backing up journal inode block information.
 
 
Signature · 1 line
2.11.0.rc0.7.gbe5a750
Reviewed-by on v1 1/5
#5 lore raw
In reply to Theodore Ts'o
Quoted 11 lines · Theodore Ts'o
---
 misc/mke2fs.conf.in  | 5 -----
 tests/mke2fs.conf.in | 5 -----
 2 files changed, 10 deletions(-)
misc/mke2fs.conf.in +0 -0
index 812f7c742..d0066b78b 100644

misc/mke2fs.conf.in line 20

Quoted 7 lines
misc/mke2fs.conf.in +0 -4
@@ -14,11 +14,6 @@
 		features = has_journal,extent,huge_file,flex_bg,uninit_bg,64bit,dir_nlink,extra_isize
 		inode_size = 256
 	}
-	ext4dev = {
-		features = has_journal,extent,huge_file,flex_bg,uninit_bg,inline_data,64bit,dir_nlink,extra_isize
-		inode_size = 256
-		options = test_fs=1

LOL, that was still there?? :)

--D

Quoted 23 lines
misc/mke2fs.conf.in +0 -1
-	}
 	small = {
 		blocksize = 1024
 		inode_size = 128
tests/mke2fs.conf.in +0 -5
index c06050d8d..ee246ba8b 100644
@@ -17,11 +17,6 @@
 		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
 		inode_size = 256
 	}
-	ext4dev = {
-		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
-		inode_size = 256
-		options = test_fs=1
-	}
 	small = {
 		blocksize = 1024
 		inode_size = 128
Signature · 1 line
2.11.0.rc0.7.gbe5a750