All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] miscellaneous kernel ext4 fixes
@ 2014-05-01 23:17 Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem Darrick J. Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

Here are a few patches that have been sitting around in my tree for a
while.  They're not interdependent; the first three are simple
bugfixes.  The last one introduces ext5, which reduces our testing
matrix by requiring a fairly large set of features and eliminating
most mount options.  True, not all the features are stable or ready
for production yet, but six years after ext4 we have a bunch of new
features ready for wider testing.

I've tested these kernel changes against 3.15-rc3.  These days, I use
several VMs, each with 8GB ramdisks to test with; the test process is
checkpatch > metadata checksum tests > xfstests.

Comments and questions are, as always, welcome.

--D

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem
  2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
@ 2014-05-01 23:17 ` Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2 Darrick J. Wong
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

On a filesystem with a 1k block size, the group descriptors live in
block 2, not block 1.  If the filesystem has bigalloc,meta_bg set,
however, the calculation of the group descriptor table location does
not take this into account and returns the wrong block number.  Fix
the calculation to return the correct value for this case.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/super.c |   10 ++++++++++
 1 file changed, 10 insertions(+)


diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6f9e6fa..32967cb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2404,6 +2404,16 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb,
 	if (ext4_bg_has_super(sb, bg))
 		has_super = 1;
 
+	/*
+	 * If we have a meta_bg fs with 1k blocks, group 0's GDT is at
+	 * block 2, not 1.  If s_first_data_block == 0 (bigalloc is enabled
+	 * on modern mke2fs or blksize > 1k on older mke2fs) then we must
+	 * compensate.
+	 */
+	if (sb->s_blocksize == 1024 && nr == 0 &&
+	    le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) == 0)
+		has_super++;
+
 	return (has_super + ext4_group_first_block_no(sb, bg));
 }
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2
  2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem Darrick J. Wong
@ 2014-05-01 23:17 ` Darrick J. Wong
  2014-05-12 14:16   ` Theodore Ts'o
  2014-05-01 23:17 ` [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg Darrick J. Wong
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

The ext4_bg_has_super() function doesn't know about the new rules for
where backup superblocks go on a sparse_super2 filesystem.  Therefore,
block bitmap initialization doesn't know that it shouldn't reserve
space for backups in groups that are never going to contain backups.
The result of this is e2fsck complaining about the block bitmap being
incorrect (fortunately not in a way that results in cross-linked
files), so fix the whole thing.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/balloc.c |   33 +++++++++++++++++++--------------
 fs/ext4/ext4.h   |    4 +++-
 2 files changed, 22 insertions(+), 15 deletions(-)


diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 5c56785..a4950e9 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -708,16 +708,6 @@ static inline int test_root(ext4_group_t a, int b)
 	}
 }
 
-static int ext4_group_sparse(ext4_group_t group)
-{
-	if (group <= 1)
-		return 1;
-	if (!(group & 1))
-		return 0;
-	return (test_root(group, 7) || test_root(group, 5) ||
-		test_root(group, 3));
-}
-
 /**
  *	ext4_bg_has_super - number of blocks used by the superblock in group
  *	@sb: superblock for filesystem
@@ -728,11 +718,26 @@ static int ext4_group_sparse(ext4_group_t group)
  */
 int ext4_bg_has_super(struct super_block *sb, ext4_group_t group)
 {
-	if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
-				EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) &&
-			!ext4_group_sparse(group))
+	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
+
+	if (group == 0)
+		return 1;
+	if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_SPARSE_SUPER2)) {
+		if (group == le32_to_cpu(es->s_backup_bgs[0]) ||
+		    group == le32_to_cpu(es->s_backup_bgs[1]))
+			return 1;
+		return 0;
+	}
+	if ((group <= 1) || !EXT4_HAS_RO_COMPAT_FEATURE(sb,
+					EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER))
+		return 1;
+	if (!(group & 1))
 		return 0;
-	return 1;
+	if (test_root(group, 3) || (test_root(group, 5)) ||
+	    test_root(group, 7))
+		return 1;
+
+	return 0;
 }
 
 static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 66946aa..fde4a27 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1159,7 +1159,8 @@ struct ext4_super_block {
 	__le32	s_usr_quota_inum;	/* inode for tracking user quota */
 	__le32	s_grp_quota_inum;	/* inode for tracking group quota */
 	__le32	s_overhead_clusters;	/* overhead blocks/clusters in fs */
-	__le32	s_reserved[108];	/* Padding to the end of the block */
+	__le32	s_backup_bgs[2];	/* groups with sparse_super2 SBs */
+	__le32	s_reserved[106];	/* Padding to the end of the block */
 	__le32	s_checksum;		/* crc32c(superblock) */
 };
 
@@ -1505,6 +1506,7 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 #define EXT4_FEATURE_COMPAT_EXT_ATTR		0x0008
 #define EXT4_FEATURE_COMPAT_RESIZE_INODE	0x0010
 #define EXT4_FEATURE_COMPAT_DIR_INDEX		0x0020
+#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2	0x0200
 
 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
 #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE	0x0002


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg
  2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2 Darrick J. Wong
@ 2014-05-01 23:17 ` Darrick J. Wong
  2014-05-12 14:22   ` Theodore Ts'o
  2014-05-01 23:17 ` [PATCH 4/5] ext4: don't crash when validating block bitmap Darrick J. Wong
  2014-05-01 23:17 ` [PATCH 5/5] ext4: enforce ext5 feature set and mount options Darrick J. Wong
  4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

On a bigalloc,^flex_bg filesystem, the ext4_valid_block_bitmap
function fails to convert from blocks to clusters when spot-checking
the validity of the bitmap block that we've just read from disk.  This
causes ext4 to think that the bitmap is garbage, which results in the
block group being taken offline when it's not necessary.  Add in the
necessary EXT4_B2C() calls to perform the conversions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/balloc.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)


diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index a4950e9..59c3ba8 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -307,6 +307,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
 					    ext4_group_t block_group,
 					    struct buffer_head *bh)
 {
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	ext4_grpblk_t offset;
 	ext4_grpblk_t next_zero_bit;
 	ext4_fsblk_t blk;
@@ -326,14 +327,14 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
 	/* check whether block bitmap block number is set */
 	blk = ext4_block_bitmap(sb, desc);
 	offset = blk - group_first_block;
-	if (!ext4_test_bit(offset, bh->b_data))
+	if (!ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
 		/* bad block bitmap */
 		return blk;
 
 	/* check whether the inode bitmap block number is set */
 	blk = ext4_inode_bitmap(sb, desc);
 	offset = blk - group_first_block;
-	if (!ext4_test_bit(offset, bh->b_data))
+	if (!ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
 		/* bad block bitmap */
 		return blk;
 
@@ -341,9 +342,10 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
 	blk = ext4_inode_table(sb, desc);
 	offset = blk - group_first_block;
 	next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
-				offset + EXT4_SB(sb)->s_itb_per_group,
-				offset);
-	if (next_zero_bit < offset + EXT4_SB(sb)->s_itb_per_group)
+			EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group),
+			EXT4_B2C(sbi, offset));
+	if (next_zero_bit <
+	    EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group))
 		/* bad bitmap for inode tables */
 		return blk;
 	return 0;


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] ext4: don't crash when validating block bitmap
  2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
                   ` (2 preceding siblings ...)
  2014-05-01 23:17 ` [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg Darrick J. Wong
@ 2014-05-01 23:17 ` Darrick J. Wong
  2014-05-12 14:24   ` Theodore Ts'o
  2014-05-01 23:17 ` [PATCH 5/5] ext4: enforce ext5 feature set and mount options Darrick J. Wong
  4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

If EXT4FS_DEBUG is defined, ext4_validate_block_bitmap is called via
ext4_count_free_clusters before sb->s_group_info is set up.  When this
happens, the kernel crashes because group info hasn't been loaded.
Forego marking the group corrupt for now; not setting BH_Verified
means we'll revisit the bitmap if something went wrong.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/balloc.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)


diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 59c3ba8..8f7bed0 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -357,7 +357,10 @@ void ext4_validate_block_bitmap(struct super_block *sb,
 			       struct buffer_head *bh)
 {
 	ext4_fsblk_t	blk;
-	struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
+	struct ext4_group_info *grp = NULL;
+
+	if (EXT4_SB(sb)->s_group_info)
+		grp = ext4_get_group_info(sb, block_group);
 
 	if (buffer_verified(bh))
 		return;
@@ -368,14 +371,18 @@ void ext4_validate_block_bitmap(struct super_block *sb,
 		ext4_unlock_group(sb, block_group);
 		ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
 			   block_group, blk);
-		set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
+		if (grp)
+			set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT,
+				&grp->bb_state);
 		return;
 	}
 	if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
 			desc, bh))) {
 		ext4_unlock_group(sb, block_group);
 		ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
-		set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
+		if (grp)
+			set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT,
+				&grp->bb_state);
 		return;
 	}
 	set_buffer_verified(bh);


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] ext4: enforce ext5 feature set and mount options
  2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
                   ` (3 preceding siblings ...)
  2014-05-01 23:17 ` [PATCH 4/5] ext4: don't crash when validating block bitmap Darrick J. Wong
@ 2014-05-01 23:17 ` Darrick J. Wong
  2014-05-02  9:47   ` Lukáš Czerner
  4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-01 23:17 UTC (permalink / raw)
  To: tytso, darrick.wong; +Cc: linux-ext4

Having defined "ext5" to be a set of required features and mount
options, check that all the required featues are present and disable
all but a handful of mount options.  See the e2fsprogs part of this
patch for the list of features and mount options that make up ext5.

Again, this is not a fork, just a way to tie some features together
and reduce our testing matrix.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/ext4.h  |   52 +++++++++++++++++
 fs/ext4/super.c |  173 +++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 176 insertions(+), 49 deletions(-)


diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index fde4a27..a19f826 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1575,6 +1575,58 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
 					 EXT4_FEATURE_RO_COMPAT_QUOTA)
 
+/* ext5 features */
+#define EXT5_FEATURE_COMPAT_REQD_MASK	(EXT4_FEATURE_COMPAT_RESIZE_INODE|\
+					 EXT4_FEATURE_COMPAT_DIR_INDEX|\
+					 EXT4_FEATURE_COMPAT_EXT_ATTR|\
+					 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
+
+#define EXT5_FEATURE_COMPAT_REQD	(EXT4_FEATURE_COMPAT_DIR_INDEX|\
+					 EXT4_FEATURE_COMPAT_EXT_ATTR|\
+					 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
+
+#define EXT5_FEATURE_INCOMPAT_REQD_MASK	(EXT4_FEATURE_INCOMPAT_FILETYPE|\
+					 EXT4_FEATURE_INCOMPAT_META_BG|\
+					 EXT4_FEATURE_INCOMPAT_EXTENTS|\
+					 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
+					 EXT4_FEATURE_INCOMPAT_64BIT|\
+					 EXT4_FEATURE_INCOMPAT_INLINE_DATA)
+
+#define EXT5_FEATURE_INCOMPAT_REQD	(EXT4_FEATURE_INCOMPAT_FILETYPE|\
+					 EXT4_FEATURE_INCOMPAT_META_BG|\
+					 EXT4_FEATURE_INCOMPAT_EXTENTS|\
+					 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
+					 EXT4_FEATURE_INCOMPAT_64BIT|\
+					 EXT4_FEATURE_INCOMPAT_INLINE_DATA)
+
+#define EXT5_FEATURE_RO_COMPAT_REQD_MASK (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER|\
+					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
+					 EXT4_FEATURE_RO_COMPAT_LARGE_FILE|\
+					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
+					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
+					 EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
+					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+
+#define EXT5_FEATURE_RO_COMPAT_REQD	(EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER|\
+					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
+					 EXT4_FEATURE_RO_COMPAT_LARGE_FILE|\
+					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
+					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
+					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+
+#define EXT5_DEF_MNTOPT_MASK		(EXT4_DEFM_XATTR_USER|\
+					 EXT4_DEFM_ACL|\
+					 EXT4_DEFM_UID16|\
+					 EXT4_DEFM_NOBARRIER|\
+					 EXT4_DEFM_BLOCK_VALIDITY|\
+					 EXT4_DEFM_NODELALLOC)
+
+#define EXT5_DEF_MNTOPT			(EXT4_DEFM_XATTR_USER|\
+					 EXT4_DEFM_ACL|\
+					 EXT4_DEFM_BLOCK_VALIDITY)
+
+#define EXT5_MINOR_REV_LEVEL		(2)
+
 /*
  * Default values for user and/or group using reserved blocks
  */
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 32967cb..508e78f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -116,6 +116,17 @@ MODULE_ALIAS("ext3");
 #define IS_EXT3_SB(sb) (0)
 #endif
 
+static struct file_system_type ext5_fs_type = {
+	.owner		= THIS_MODULE,
+	.name		= "ext5",
+	.mount		= ext4_mount,
+	.kill_sb	= kill_block_super,
+	.fs_flags	= FS_REQUIRES_DEV,
+};
+MODULE_ALIAS_FS("ext5");
+MODULE_ALIAS("ext5");
+#define IS_EXT5_SB(sb) ((sb)->s_bdev->bd_holder == &ext5_fs_type)
+
 static int ext4_verify_csum_type(struct super_block *sb,
 				 struct ext4_super_block *es)
 {
@@ -386,6 +397,24 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
  * that error until we've noted it down and cleared it.
  */
 
+static int is_ext5_fs(struct super_block *sb)
+{
+	return (IS_EXT5_SB(sb) ||
+		le16_to_cpu(EXT4_SB(sb)->s_es->s_minor_rev_level) ==
+		EXT5_MINOR_REV_LEVEL);
+}
+
+static int ext4_level(struct super_block *sb)
+{
+	if (IS_EXT2_SB(sb))
+		return 2;
+	if (IS_EXT3_SB(sb))
+		return 3;
+	if (is_ext5_fs(sb))
+		return 5;
+	return 4;
+}
+
 static void ext4_handle_error(struct super_block *sb)
 {
 	if (sb->s_flags & MS_RDONLY)
@@ -408,8 +437,8 @@ static void ext4_handle_error(struct super_block *sb)
 		sb->s_flags |= MS_RDONLY;
 	}
 	if (test_opt(sb, ERRORS_PANIC))
-		panic("EXT4-fs (device %s): panic forced after error\n",
-			sb->s_id);
+		panic("EXT%d-fs (device %s): panic forced after error\n",
+			ext4_level(sb), sb->s_id);
 }
 
 #define ext4_error_ratelimit(sb)					\
@@ -427,8 +456,9 @@ void __ext4_error(struct super_block *sb, const char *function,
 		vaf.fmt = fmt;
 		vaf.va = &args;
 		printk(KERN_CRIT
-		       "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n",
-		       sb->s_id, function, line, current->comm, &vaf);
+		       "EXT%d-fs error (device %s): %s:%d: comm %s: %pV\n",
+		       ext4_level(sb), sb->s_id, function, line, current->comm,
+		       &vaf);
 		va_end(args);
 	}
 	save_error_info(sb, function, line);
@@ -450,15 +480,17 @@ void __ext4_error_inode(struct inode *inode, const char *function,
 		vaf.fmt = fmt;
 		vaf.va = &args;
 		if (block)
-			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
+			printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: "
 			       "inode #%lu: block %llu: comm %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
-			       block, current->comm, &vaf);
+			       ext4_level(inode->i_sb), inode->i_sb->s_id,
+			       function, line, inode->i_ino, block,
+			       current->comm, &vaf);
 		else
-			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
+			printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: "
 			       "inode #%lu: comm %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
-			       current->comm, &vaf);
+			       ext4_level(inode->i_sb), inode->i_sb->s_id,
+			       function, line, inode->i_ino, current->comm,
+			       &vaf);
 		va_end(args);
 	}
 	save_error_info(inode->i_sb, function, line);
@@ -486,16 +518,18 @@ void __ext4_error_file(struct file *file, const char *function,
 		vaf.va = &args;
 		if (block)
 			printk(KERN_CRIT
-			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
+			       "EXT%d-fs error (device %s): %s:%d: inode #%lu: "
 			       "block %llu: comm %s: path %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
-			       block, current->comm, path, &vaf);
+			       ext4_level(inode->i_sb), inode->i_sb->s_id,
+			       function, line, inode->i_ino, block,
+			       current->comm, path, &vaf);
 		else
 			printk(KERN_CRIT
-			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
+			       "EXT%d-fs error (device %s): %s:%d: inode #%lu: "
 			       "comm %s: path %s: %pV\n",
-			       inode->i_sb->s_id, function, line, inode->i_ino,
-			       current->comm, path, &vaf);
+			       ext4_level(inode->i_sb), inode->i_sb->s_id,
+			       function, line, inode->i_ino, current->comm,
+			       path, &vaf);
 		va_end(args);
 	}
 	save_error_info(inode->i_sb, function, line);
@@ -554,8 +588,8 @@ void __ext4_std_error(struct super_block *sb, const char *function,
 
 	if (ext4_error_ratelimit(sb)) {
 		errstr = ext4_decode_error(sb, errno, nbuf);
-		printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n",
-		       sb->s_id, function, line, errstr);
+		printk(KERN_CRIT "EXT%d-fs error (device %s) in %s:%d: %s\n",
+		       ext4_level(sb), sb->s_id, function, line, errstr);
 	}
 
 	save_error_info(sb, function, line);
@@ -579,8 +613,8 @@ void __ext4_abort(struct super_block *sb, const char *function,
 
 	save_error_info(sb, function, line);
 	va_start(args, fmt);
-	printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id,
-	       function, line);
+	printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: ",
+	       ext4_level(sb), sb->s_id, function, line);
 	vprintk(fmt, args);
 	printk("\n");
 	va_end(args);
@@ -599,7 +633,7 @@ void __ext4_abort(struct super_block *sb, const char *function,
 		save_error_info(sb, function, line);
 	}
 	if (test_opt(sb, ERRORS_PANIC))
-		panic("EXT4-fs panic from previous error\n");
+		panic("EXT%d-fs panic from previous error\n", ext4_level(sb));
 }
 
 void __ext4_msg(struct super_block *sb,
@@ -614,7 +648,8 @@ void __ext4_msg(struct super_block *sb,
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
+	printk("%sEXT%d-fs (%s): %pV\n", prefix, ext4_level(sb), sb->s_id,
+	       &vaf);
 	va_end(args);
 }
 
@@ -631,8 +666,8 @@ void __ext4_warning(struct super_block *sb, const char *function,
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: %pV\n",
-	       sb->s_id, function, line, &vaf);
+	printk(KERN_WARNING "EXT%d-fs warning (device %s): %s:%d: %pV\n",
+	       ext4_level(sb), sb->s_id, function, line, &vaf);
 	va_end(args);
 }
 
@@ -655,8 +690,8 @@ __acquires(bitlock)
 		va_start(args, fmt);
 		vaf.fmt = fmt;
 		vaf.va = &args;
-		printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u, ",
-		       sb->s_id, function, line, grp);
+		printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: group %u, ",
+		       ext4_level(sb), sb->s_id, function, line, grp);
 		if (ino)
 			printk(KERN_CONT "inode %lu: ", ino);
 		if (block)
@@ -1360,6 +1395,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
 #define MOPT_NO_EXT3	0x0200
 #define MOPT_EXT4_ONLY	(MOPT_NO_EXT2 | MOPT_NO_EXT3)
 #define MOPT_STRING	0x0400
+#define MOPT_EXT5_OPT	0x0800
 
 static const struct mount_opts {
 	int	token;
@@ -1370,27 +1406,27 @@ static const struct mount_opts {
 	{Opt_bsd_df, EXT4_MOUNT_MINIX_DF, MOPT_CLEAR},
 	{Opt_grpid, EXT4_MOUNT_GRPID, MOPT_SET},
 	{Opt_nogrpid, EXT4_MOUNT_GRPID, MOPT_CLEAR},
-	{Opt_block_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_SET},
+	{Opt_block_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_EXT5_OPT | MOPT_SET},
 	{Opt_noblock_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_CLEAR},
 	{Opt_dioread_nolock, EXT4_MOUNT_DIOREAD_NOLOCK,
 	 MOPT_EXT4_ONLY | MOPT_SET},
 	{Opt_dioread_lock, EXT4_MOUNT_DIOREAD_NOLOCK,
 	 MOPT_EXT4_ONLY | MOPT_CLEAR},
-	{Opt_discard, EXT4_MOUNT_DISCARD, MOPT_SET},
-	{Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_CLEAR},
+	{Opt_discard, EXT4_MOUNT_DISCARD, MOPT_EXT5_OPT | MOPT_SET},
+	{Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_EXT5_OPT | MOPT_CLEAR},
 	{Opt_delalloc, EXT4_MOUNT_DELALLOC,
 	 MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT},
 	{Opt_nodelalloc, EXT4_MOUNT_DELALLOC,
 	 MOPT_EXT4_ONLY | MOPT_CLEAR},
 	{Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
-	 MOPT_EXT4_ONLY | MOPT_SET},
+	 MOPT_EXT5_OPT | MOPT_EXT4_ONLY | MOPT_SET},
 	{Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
 				    EXT4_MOUNT_JOURNAL_CHECKSUM),
 	 MOPT_EXT4_ONLY | MOPT_SET},
 	{Opt_noload, EXT4_MOUNT_NOLOAD, MOPT_NO_EXT2 | MOPT_SET},
-	{Opt_err_panic, EXT4_MOUNT_ERRORS_PANIC, MOPT_SET | MOPT_CLEAR_ERR},
-	{Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_SET | MOPT_CLEAR_ERR},
-	{Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_SET | MOPT_CLEAR_ERR},
+	{Opt_err_panic, EXT4_MOUNT_ERRORS_PANIC, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
+	{Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
+	{Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
 	{Opt_data_err_abort, EXT4_MOUNT_DATA_ERR_ABORT,
 	 MOPT_NO_EXT2 | MOPT_SET},
 	{Opt_data_err_ignore, EXT4_MOUNT_DATA_ERR_ABORT,
@@ -1408,24 +1444,24 @@ static const struct mount_opts {
 	{Opt_stripe, 0, MOPT_GTE0},
 	{Opt_resuid, 0, MOPT_GTE0},
 	{Opt_resgid, 0, MOPT_GTE0},
-	{Opt_journal_dev, 0, MOPT_GTE0},
-	{Opt_journal_path, 0, MOPT_STRING},
+	{Opt_journal_dev, 0, MOPT_EXT5_OPT | MOPT_GTE0},
+	{Opt_journal_path, 0, MOPT_EXT5_OPT | MOPT_STRING},
 	{Opt_journal_ioprio, 0, MOPT_GTE0},
-	{Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_NO_EXT2 | MOPT_DATAJ},
-	{Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_NO_EXT2 | MOPT_DATAJ},
+	{Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
+	{Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
 	{Opt_data_writeback, EXT4_MOUNT_WRITEBACK_DATA,
-	 MOPT_NO_EXT2 | MOPT_DATAJ},
-	{Opt_user_xattr, EXT4_MOUNT_XATTR_USER, MOPT_SET},
+	 MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
+	{Opt_user_xattr, EXT4_MOUNT_XATTR_USER, MOPT_EXT5_OPT | MOPT_SET},
 	{Opt_nouser_xattr, EXT4_MOUNT_XATTR_USER, MOPT_CLEAR},
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
-	{Opt_acl, EXT4_MOUNT_POSIX_ACL, MOPT_SET},
+	{Opt_acl, EXT4_MOUNT_POSIX_ACL, MOPT_EXT5_OPT | MOPT_SET},
 	{Opt_noacl, EXT4_MOUNT_POSIX_ACL, MOPT_CLEAR},
 #else
 	{Opt_acl, 0, MOPT_NOSUPPORT},
 	{Opt_noacl, 0, MOPT_NOSUPPORT},
 #endif
 	{Opt_nouid32, EXT4_MOUNT_NO_UID32, MOPT_SET},
-	{Opt_debug, EXT4_MOUNT_DEBUG, MOPT_SET},
+	{Opt_debug, EXT4_MOUNT_DEBUG, MOPT_EXT5_OPT | MOPT_SET},
 	{Opt_quota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA, MOPT_SET | MOPT_Q},
 	{Opt_usrquota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA,
 							MOPT_SET | MOPT_Q},
@@ -1502,6 +1538,11 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 			 "Mount option \"%s\" incompatible with ext3", opt);
 		return -1;
 	}
+	if (!(m->flags & MOPT_EXT5_OPT) && is_ext5_fs(sb)) {
+		ext4_msg(sb, KERN_ERR,
+			 "Mount option \"%s\" incompatible with ext5", opt);
+		return -1;
+	}
 
 	if (args->from && !(m->flags & MOPT_STRING) && match_int(args, &arg))
 		return -1;
@@ -1532,7 +1573,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 	} else if (token == Opt_inode_readahead_blks) {
 		if (arg && (arg > (1 << 30) || !is_power_of_2(arg))) {
 			ext4_msg(sb, KERN_ERR,
-				 "EXT4-fs: inode_readahead_blks must be "
+				 "inode_readahead_blks must be "
 				 "0 or a power of 2 smaller than 2^31");
 			return -1;
 		}
@@ -2811,8 +2852,9 @@ static void print_daily_error_info(unsigned long arg)
 		ext4_msg(sb, KERN_NOTICE, "error count: %u",
 			 le32_to_cpu(es->s_error_count));
 	if (es->s_first_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d",
-		       sb->s_id, le32_to_cpu(es->s_first_error_time),
+		printk(KERN_NOTICE "EXT%d-fs (%s): initial error at %u: %.*s:%d",
+		       ext4_level(sb), sb->s_id,
+		       le32_to_cpu(es->s_first_error_time),
 		       (int) sizeof(es->s_first_error_func),
 		       es->s_first_error_func,
 		       le32_to_cpu(es->s_first_error_line));
@@ -2825,8 +2867,9 @@ static void print_daily_error_info(unsigned long arg)
 		printk("\n");
 	}
 	if (es->s_last_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d",
-		       sb->s_id, le32_to_cpu(es->s_last_error_time),
+		printk(KERN_NOTICE "EXT%d-fs (%s): last error at %u: %.*s:%d",
+		       ext4_level(sb), sb->s_id,
+		       le32_to_cpu(es->s_last_error_time),
 		       (int) sizeof(es->s_last_error_func),
 		       es->s_last_error_func,
 		       le32_to_cpu(es->s_last_error_line));
@@ -3495,6 +3538,31 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,
 					       sizeof(es->s_uuid));
 
+	/* check ext5 features and mount options */
+	if (IS_EXT5_SB(sb) &&
+	    le16_to_cpu(es->s_minor_rev_level) != EXT5_MINOR_REV_LEVEL) {
+		ext4_msg(sb, KERN_ERR, "VFS: Trying to mount non-ext5 "
+			 "filesystem as ext5?");
+		goto failed_mount;
+	}
+
+	if ((le16_to_cpu(es->s_minor_rev_level) == EXT5_MINOR_REV_LEVEL) &&
+	    ((le32_to_cpu(es->s_feature_incompat) &
+	      EXT5_FEATURE_INCOMPAT_REQD_MASK) != EXT5_FEATURE_INCOMPAT_REQD ||
+	     (le32_to_cpu(es->s_feature_ro_compat) &
+	      EXT5_FEATURE_RO_COMPAT_REQD_MASK) != EXT5_FEATURE_RO_COMPAT_REQD ||
+	     (le32_to_cpu(es->s_feature_compat) &
+	      EXT5_FEATURE_COMPAT_REQD_MASK) != EXT5_FEATURE_COMPAT_REQD ||
+	     (le32_to_cpu(es->s_default_mount_opts) &
+	      EXT5_DEF_MNTOPT_MASK) != EXT5_DEF_MNTOPT)) {
+		ext4_msg(sb, KERN_ERR, "VFS: Found ext5 filesystem with "
+			 "missing features.  Run e2fsck?");
+		goto failed_mount;
+	}
+
+	if (is_ext5_fs(sb))
+		set_opt(sb, JOURNAL_CHECKSUM);
+
 	/* Set defaults before we parse the mount options */
 	def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
 	set_opt(sb, INIT_INODE_TABLE);
@@ -3562,9 +3630,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		goto failed_mount;
 
 	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
-		printk_once(KERN_WARNING "EXT4-fs: Warning: mounting "
+		printk_once(KERN_WARNING "EXT%d-fs: Warning: mounting "
 			    "with data=journal disables delayed "
-			    "allocation and O_DIRECT support!\n");
+			    "allocation and O_DIRECT support!\n",
+			    ext4_level(sb));
 		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "
 				 "both data=journal and delalloc");
@@ -4073,7 +4142,8 @@ no_journal:
 	EXT4_SB(sb)->rsv_conversion_wq =
 		alloc_workqueue("ext4-rsv-conversion", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
 	if (!EXT4_SB(sb)->rsv_conversion_wq) {
-		printk(KERN_ERR "EXT4-fs: failed to create workqueue\n");
+		printk(KERN_ERR "EXT%d-fs: failed to create workqueue\n",
+		       ext4_level(sb));
 		ret = -ENOMEM;
 		goto failed_mount4;
 	}
@@ -5563,6 +5633,9 @@ static int __init ext4_init_fs(void)
 		goto out1;
 	register_as_ext3();
 	register_as_ext2();
+	err = register_filesystem(&ext5_fs_type);
+	if (err)
+		goto out;
 	err = register_filesystem(&ext4_fs_type);
 	if (err)
 		goto out;
@@ -5571,6 +5644,7 @@ static int __init ext4_init_fs(void)
 out:
 	unregister_as_ext2();
 	unregister_as_ext3();
+	unregister_filesystem(&ext4_fs_type);
 	destroy_inodecache();
 out1:
 	ext4_mballoc_ready = 0;
@@ -5597,6 +5671,7 @@ static void __exit ext4_exit_fs(void)
 	unregister_as_ext2();
 	unregister_as_ext3();
 	unregister_filesystem(&ext4_fs_type);
+	unregister_filesystem(&ext5_fs_type);
 	destroy_inodecache();
 	ext4_exit_mballoc();
 	ext4_exit_feat_adverts();


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] ext4: enforce ext5 feature set and mount options
  2014-05-01 23:17 ` [PATCH 5/5] ext4: enforce ext5 feature set and mount options Darrick J. Wong
@ 2014-05-02  9:47   ` Lukáš Czerner
  0 siblings, 0 replies; 11+ messages in thread
From: Lukáš Czerner @ 2014-05-02  9:47 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: tytso, linux-ext4

On Thu, 1 May 2014, Darrick J. Wong wrote:

> Date: Thu, 01 May 2014 16:17:53 -0700
> From: Darrick J. Wong <darrick.wong@oracle.com>
> To: tytso@mit.edu, darrick.wong@oracle.com
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 5/5] ext4: enforce ext5 feature set and mount options
> 
> Having defined "ext5" to be a set of required features and mount
> options, check that all the required featues are present and disable
> all but a handful of mount options.  See the e2fsprogs part of this
> patch for the list of features and mount options that make up ext5.
> 
> Again, this is not a fork, just a way to tie some features together
> and reduce our testing matrix.

See my reply to the e2fsprogs couterpart. I think that if that's
supposed to be for testing we can achieve this much more simply by
spcifying features in mke2fs.conf. There is no need to introduce new
file system type at all.

Thanks!
-Lukas

> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/ext4/ext4.h  |   52 +++++++++++++++++
>  fs/ext4/super.c |  173 +++++++++++++++++++++++++++++++++++++++----------------
>  2 files changed, 176 insertions(+), 49 deletions(-)
> 
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index fde4a27..a19f826 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -1575,6 +1575,58 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
>  					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
>  					 EXT4_FEATURE_RO_COMPAT_QUOTA)
>  
> +/* ext5 features */
> +#define EXT5_FEATURE_COMPAT_REQD_MASK	(EXT4_FEATURE_COMPAT_RESIZE_INODE|\
> +					 EXT4_FEATURE_COMPAT_DIR_INDEX|\
> +					 EXT4_FEATURE_COMPAT_EXT_ATTR|\
> +					 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
> +
> +#define EXT5_FEATURE_COMPAT_REQD	(EXT4_FEATURE_COMPAT_DIR_INDEX|\
> +					 EXT4_FEATURE_COMPAT_EXT_ATTR|\
> +					 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
> +
> +#define EXT5_FEATURE_INCOMPAT_REQD_MASK	(EXT4_FEATURE_INCOMPAT_FILETYPE|\
> +					 EXT4_FEATURE_INCOMPAT_META_BG|\
> +					 EXT4_FEATURE_INCOMPAT_EXTENTS|\
> +					 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
> +					 EXT4_FEATURE_INCOMPAT_64BIT|\
> +					 EXT4_FEATURE_INCOMPAT_INLINE_DATA)
> +
> +#define EXT5_FEATURE_INCOMPAT_REQD	(EXT4_FEATURE_INCOMPAT_FILETYPE|\
> +					 EXT4_FEATURE_INCOMPAT_META_BG|\
> +					 EXT4_FEATURE_INCOMPAT_EXTENTS|\
> +					 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
> +					 EXT4_FEATURE_INCOMPAT_64BIT|\
> +					 EXT4_FEATURE_INCOMPAT_INLINE_DATA)
> +
> +#define EXT5_FEATURE_RO_COMPAT_REQD_MASK (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER|\
> +					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
> +					 EXT4_FEATURE_RO_COMPAT_LARGE_FILE|\
> +					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
> +					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
> +					 EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
> +					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
> +
> +#define EXT5_FEATURE_RO_COMPAT_REQD	(EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER|\
> +					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
> +					 EXT4_FEATURE_RO_COMPAT_LARGE_FILE|\
> +					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
> +					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
> +					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
> +
> +#define EXT5_DEF_MNTOPT_MASK		(EXT4_DEFM_XATTR_USER|\
> +					 EXT4_DEFM_ACL|\
> +					 EXT4_DEFM_UID16|\
> +					 EXT4_DEFM_NOBARRIER|\
> +					 EXT4_DEFM_BLOCK_VALIDITY|\
> +					 EXT4_DEFM_NODELALLOC)
> +
> +#define EXT5_DEF_MNTOPT			(EXT4_DEFM_XATTR_USER|\
> +					 EXT4_DEFM_ACL|\
> +					 EXT4_DEFM_BLOCK_VALIDITY)
> +
> +#define EXT5_MINOR_REV_LEVEL		(2)
> +
>  /*
>   * Default values for user and/or group using reserved blocks
>   */
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 32967cb..508e78f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -116,6 +116,17 @@ MODULE_ALIAS("ext3");
>  #define IS_EXT3_SB(sb) (0)
>  #endif
>  
> +static struct file_system_type ext5_fs_type = {
> +	.owner		= THIS_MODULE,
> +	.name		= "ext5",
> +	.mount		= ext4_mount,
> +	.kill_sb	= kill_block_super,
> +	.fs_flags	= FS_REQUIRES_DEV,
> +};
> +MODULE_ALIAS_FS("ext5");
> +MODULE_ALIAS("ext5");
> +#define IS_EXT5_SB(sb) ((sb)->s_bdev->bd_holder == &ext5_fs_type)
> +
>  static int ext4_verify_csum_type(struct super_block *sb,
>  				 struct ext4_super_block *es)
>  {
> @@ -386,6 +397,24 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
>   * that error until we've noted it down and cleared it.
>   */
>  
> +static int is_ext5_fs(struct super_block *sb)
> +{
> +	return (IS_EXT5_SB(sb) ||
> +		le16_to_cpu(EXT4_SB(sb)->s_es->s_minor_rev_level) ==
> +		EXT5_MINOR_REV_LEVEL);
> +}
> +
> +static int ext4_level(struct super_block *sb)
> +{
> +	if (IS_EXT2_SB(sb))
> +		return 2;
> +	if (IS_EXT3_SB(sb))
> +		return 3;
> +	if (is_ext5_fs(sb))
> +		return 5;
> +	return 4;
> +}
> +
>  static void ext4_handle_error(struct super_block *sb)
>  {
>  	if (sb->s_flags & MS_RDONLY)
> @@ -408,8 +437,8 @@ static void ext4_handle_error(struct super_block *sb)
>  		sb->s_flags |= MS_RDONLY;
>  	}
>  	if (test_opt(sb, ERRORS_PANIC))
> -		panic("EXT4-fs (device %s): panic forced after error\n",
> -			sb->s_id);
> +		panic("EXT%d-fs (device %s): panic forced after error\n",
> +			ext4_level(sb), sb->s_id);
>  }
>  
>  #define ext4_error_ratelimit(sb)					\
> @@ -427,8 +456,9 @@ void __ext4_error(struct super_block *sb, const char *function,
>  		vaf.fmt = fmt;
>  		vaf.va = &args;
>  		printk(KERN_CRIT
> -		       "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n",
> -		       sb->s_id, function, line, current->comm, &vaf);
> +		       "EXT%d-fs error (device %s): %s:%d: comm %s: %pV\n",
> +		       ext4_level(sb), sb->s_id, function, line, current->comm,
> +		       &vaf);
>  		va_end(args);
>  	}
>  	save_error_info(sb, function, line);
> @@ -450,15 +480,17 @@ void __ext4_error_inode(struct inode *inode, const char *function,
>  		vaf.fmt = fmt;
>  		vaf.va = &args;
>  		if (block)
> -			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
> +			printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: "
>  			       "inode #%lu: block %llu: comm %s: %pV\n",
> -			       inode->i_sb->s_id, function, line, inode->i_ino,
> -			       block, current->comm, &vaf);
> +			       ext4_level(inode->i_sb), inode->i_sb->s_id,
> +			       function, line, inode->i_ino, block,
> +			       current->comm, &vaf);
>  		else
> -			printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: "
> +			printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: "
>  			       "inode #%lu: comm %s: %pV\n",
> -			       inode->i_sb->s_id, function, line, inode->i_ino,
> -			       current->comm, &vaf);
> +			       ext4_level(inode->i_sb), inode->i_sb->s_id,
> +			       function, line, inode->i_ino, current->comm,
> +			       &vaf);
>  		va_end(args);
>  	}
>  	save_error_info(inode->i_sb, function, line);
> @@ -486,16 +518,18 @@ void __ext4_error_file(struct file *file, const char *function,
>  		vaf.va = &args;
>  		if (block)
>  			printk(KERN_CRIT
> -			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
> +			       "EXT%d-fs error (device %s): %s:%d: inode #%lu: "
>  			       "block %llu: comm %s: path %s: %pV\n",
> -			       inode->i_sb->s_id, function, line, inode->i_ino,
> -			       block, current->comm, path, &vaf);
> +			       ext4_level(inode->i_sb), inode->i_sb->s_id,
> +			       function, line, inode->i_ino, block,
> +			       current->comm, path, &vaf);
>  		else
>  			printk(KERN_CRIT
> -			       "EXT4-fs error (device %s): %s:%d: inode #%lu: "
> +			       "EXT%d-fs error (device %s): %s:%d: inode #%lu: "
>  			       "comm %s: path %s: %pV\n",
> -			       inode->i_sb->s_id, function, line, inode->i_ino,
> -			       current->comm, path, &vaf);
> +			       ext4_level(inode->i_sb), inode->i_sb->s_id,
> +			       function, line, inode->i_ino, current->comm,
> +			       path, &vaf);
>  		va_end(args);
>  	}
>  	save_error_info(inode->i_sb, function, line);
> @@ -554,8 +588,8 @@ void __ext4_std_error(struct super_block *sb, const char *function,
>  
>  	if (ext4_error_ratelimit(sb)) {
>  		errstr = ext4_decode_error(sb, errno, nbuf);
> -		printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n",
> -		       sb->s_id, function, line, errstr);
> +		printk(KERN_CRIT "EXT%d-fs error (device %s) in %s:%d: %s\n",
> +		       ext4_level(sb), sb->s_id, function, line, errstr);
>  	}
>  
>  	save_error_info(sb, function, line);
> @@ -579,8 +613,8 @@ void __ext4_abort(struct super_block *sb, const char *function,
>  
>  	save_error_info(sb, function, line);
>  	va_start(args, fmt);
> -	printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id,
> -	       function, line);
> +	printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: ",
> +	       ext4_level(sb), sb->s_id, function, line);
>  	vprintk(fmt, args);
>  	printk("\n");
>  	va_end(args);
> @@ -599,7 +633,7 @@ void __ext4_abort(struct super_block *sb, const char *function,
>  		save_error_info(sb, function, line);
>  	}
>  	if (test_opt(sb, ERRORS_PANIC))
> -		panic("EXT4-fs panic from previous error\n");
> +		panic("EXT%d-fs panic from previous error\n", ext4_level(sb));
>  }
>  
>  void __ext4_msg(struct super_block *sb,
> @@ -614,7 +648,8 @@ void __ext4_msg(struct super_block *sb,
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
> -	printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
> +	printk("%sEXT%d-fs (%s): %pV\n", prefix, ext4_level(sb), sb->s_id,
> +	       &vaf);
>  	va_end(args);
>  }
>  
> @@ -631,8 +666,8 @@ void __ext4_warning(struct super_block *sb, const char *function,
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
> -	printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: %pV\n",
> -	       sb->s_id, function, line, &vaf);
> +	printk(KERN_WARNING "EXT%d-fs warning (device %s): %s:%d: %pV\n",
> +	       ext4_level(sb), sb->s_id, function, line, &vaf);
>  	va_end(args);
>  }
>  
> @@ -655,8 +690,8 @@ __acquires(bitlock)
>  		va_start(args, fmt);
>  		vaf.fmt = fmt;
>  		vaf.va = &args;
> -		printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u, ",
> -		       sb->s_id, function, line, grp);
> +		printk(KERN_CRIT "EXT%d-fs error (device %s): %s:%d: group %u, ",
> +		       ext4_level(sb), sb->s_id, function, line, grp);
>  		if (ino)
>  			printk(KERN_CONT "inode %lu: ", ino);
>  		if (block)
> @@ -1360,6 +1395,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
>  #define MOPT_NO_EXT3	0x0200
>  #define MOPT_EXT4_ONLY	(MOPT_NO_EXT2 | MOPT_NO_EXT3)
>  #define MOPT_STRING	0x0400
> +#define MOPT_EXT5_OPT	0x0800
>  
>  static const struct mount_opts {
>  	int	token;
> @@ -1370,27 +1406,27 @@ static const struct mount_opts {
>  	{Opt_bsd_df, EXT4_MOUNT_MINIX_DF, MOPT_CLEAR},
>  	{Opt_grpid, EXT4_MOUNT_GRPID, MOPT_SET},
>  	{Opt_nogrpid, EXT4_MOUNT_GRPID, MOPT_CLEAR},
> -	{Opt_block_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_SET},
> +	{Opt_block_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_EXT5_OPT | MOPT_SET},
>  	{Opt_noblock_validity, EXT4_MOUNT_BLOCK_VALIDITY, MOPT_CLEAR},
>  	{Opt_dioread_nolock, EXT4_MOUNT_DIOREAD_NOLOCK,
>  	 MOPT_EXT4_ONLY | MOPT_SET},
>  	{Opt_dioread_lock, EXT4_MOUNT_DIOREAD_NOLOCK,
>  	 MOPT_EXT4_ONLY | MOPT_CLEAR},
> -	{Opt_discard, EXT4_MOUNT_DISCARD, MOPT_SET},
> -	{Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_CLEAR},
> +	{Opt_discard, EXT4_MOUNT_DISCARD, MOPT_EXT5_OPT | MOPT_SET},
> +	{Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_EXT5_OPT | MOPT_CLEAR},
>  	{Opt_delalloc, EXT4_MOUNT_DELALLOC,
>  	 MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT},
>  	{Opt_nodelalloc, EXT4_MOUNT_DELALLOC,
>  	 MOPT_EXT4_ONLY | MOPT_CLEAR},
>  	{Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM,
> -	 MOPT_EXT4_ONLY | MOPT_SET},
> +	 MOPT_EXT5_OPT | MOPT_EXT4_ONLY | MOPT_SET},
>  	{Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
>  				    EXT4_MOUNT_JOURNAL_CHECKSUM),
>  	 MOPT_EXT4_ONLY | MOPT_SET},
>  	{Opt_noload, EXT4_MOUNT_NOLOAD, MOPT_NO_EXT2 | MOPT_SET},
> -	{Opt_err_panic, EXT4_MOUNT_ERRORS_PANIC, MOPT_SET | MOPT_CLEAR_ERR},
> -	{Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_SET | MOPT_CLEAR_ERR},
> -	{Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_SET | MOPT_CLEAR_ERR},
> +	{Opt_err_panic, EXT4_MOUNT_ERRORS_PANIC, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
> +	{Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
> +	{Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_EXT5_OPT | MOPT_SET | MOPT_CLEAR_ERR},
>  	{Opt_data_err_abort, EXT4_MOUNT_DATA_ERR_ABORT,
>  	 MOPT_NO_EXT2 | MOPT_SET},
>  	{Opt_data_err_ignore, EXT4_MOUNT_DATA_ERR_ABORT,
> @@ -1408,24 +1444,24 @@ static const struct mount_opts {
>  	{Opt_stripe, 0, MOPT_GTE0},
>  	{Opt_resuid, 0, MOPT_GTE0},
>  	{Opt_resgid, 0, MOPT_GTE0},
> -	{Opt_journal_dev, 0, MOPT_GTE0},
> -	{Opt_journal_path, 0, MOPT_STRING},
> +	{Opt_journal_dev, 0, MOPT_EXT5_OPT | MOPT_GTE0},
> +	{Opt_journal_path, 0, MOPT_EXT5_OPT | MOPT_STRING},
>  	{Opt_journal_ioprio, 0, MOPT_GTE0},
> -	{Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_NO_EXT2 | MOPT_DATAJ},
> -	{Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_NO_EXT2 | MOPT_DATAJ},
> +	{Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
> +	{Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
>  	{Opt_data_writeback, EXT4_MOUNT_WRITEBACK_DATA,
> -	 MOPT_NO_EXT2 | MOPT_DATAJ},
> -	{Opt_user_xattr, EXT4_MOUNT_XATTR_USER, MOPT_SET},
> +	 MOPT_EXT5_OPT | MOPT_NO_EXT2 | MOPT_DATAJ},
> +	{Opt_user_xattr, EXT4_MOUNT_XATTR_USER, MOPT_EXT5_OPT | MOPT_SET},
>  	{Opt_nouser_xattr, EXT4_MOUNT_XATTR_USER, MOPT_CLEAR},
>  #ifdef CONFIG_EXT4_FS_POSIX_ACL
> -	{Opt_acl, EXT4_MOUNT_POSIX_ACL, MOPT_SET},
> +	{Opt_acl, EXT4_MOUNT_POSIX_ACL, MOPT_EXT5_OPT | MOPT_SET},
>  	{Opt_noacl, EXT4_MOUNT_POSIX_ACL, MOPT_CLEAR},
>  #else
>  	{Opt_acl, 0, MOPT_NOSUPPORT},
>  	{Opt_noacl, 0, MOPT_NOSUPPORT},
>  #endif
>  	{Opt_nouid32, EXT4_MOUNT_NO_UID32, MOPT_SET},
> -	{Opt_debug, EXT4_MOUNT_DEBUG, MOPT_SET},
> +	{Opt_debug, EXT4_MOUNT_DEBUG, MOPT_EXT5_OPT | MOPT_SET},
>  	{Opt_quota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA, MOPT_SET | MOPT_Q},
>  	{Opt_usrquota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA,
>  							MOPT_SET | MOPT_Q},
> @@ -1502,6 +1538,11 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
>  			 "Mount option \"%s\" incompatible with ext3", opt);
>  		return -1;
>  	}
> +	if (!(m->flags & MOPT_EXT5_OPT) && is_ext5_fs(sb)) {
> +		ext4_msg(sb, KERN_ERR,
> +			 "Mount option \"%s\" incompatible with ext5", opt);
> +		return -1;
> +	}
>  
>  	if (args->from && !(m->flags & MOPT_STRING) && match_int(args, &arg))
>  		return -1;
> @@ -1532,7 +1573,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
>  	} else if (token == Opt_inode_readahead_blks) {
>  		if (arg && (arg > (1 << 30) || !is_power_of_2(arg))) {
>  			ext4_msg(sb, KERN_ERR,
> -				 "EXT4-fs: inode_readahead_blks must be "
> +				 "inode_readahead_blks must be "
>  				 "0 or a power of 2 smaller than 2^31");
>  			return -1;
>  		}
> @@ -2811,8 +2852,9 @@ static void print_daily_error_info(unsigned long arg)
>  		ext4_msg(sb, KERN_NOTICE, "error count: %u",
>  			 le32_to_cpu(es->s_error_count));
>  	if (es->s_first_error_time) {
> -		printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d",
> -		       sb->s_id, le32_to_cpu(es->s_first_error_time),
> +		printk(KERN_NOTICE "EXT%d-fs (%s): initial error at %u: %.*s:%d",
> +		       ext4_level(sb), sb->s_id,
> +		       le32_to_cpu(es->s_first_error_time),
>  		       (int) sizeof(es->s_first_error_func),
>  		       es->s_first_error_func,
>  		       le32_to_cpu(es->s_first_error_line));
> @@ -2825,8 +2867,9 @@ static void print_daily_error_info(unsigned long arg)
>  		printk("\n");
>  	}
>  	if (es->s_last_error_time) {
> -		printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d",
> -		       sb->s_id, le32_to_cpu(es->s_last_error_time),
> +		printk(KERN_NOTICE "EXT%d-fs (%s): last error at %u: %.*s:%d",
> +		       ext4_level(sb), sb->s_id,
> +		       le32_to_cpu(es->s_last_error_time),
>  		       (int) sizeof(es->s_last_error_func),
>  		       es->s_last_error_func,
>  		       le32_to_cpu(es->s_last_error_line));
> @@ -3495,6 +3538,31 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		sbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,
>  					       sizeof(es->s_uuid));
>  
> +	/* check ext5 features and mount options */
> +	if (IS_EXT5_SB(sb) &&
> +	    le16_to_cpu(es->s_minor_rev_level) != EXT5_MINOR_REV_LEVEL) {
> +		ext4_msg(sb, KERN_ERR, "VFS: Trying to mount non-ext5 "
> +			 "filesystem as ext5?");
> +		goto failed_mount;
> +	}
> +
> +	if ((le16_to_cpu(es->s_minor_rev_level) == EXT5_MINOR_REV_LEVEL) &&
> +	    ((le32_to_cpu(es->s_feature_incompat) &
> +	      EXT5_FEATURE_INCOMPAT_REQD_MASK) != EXT5_FEATURE_INCOMPAT_REQD ||
> +	     (le32_to_cpu(es->s_feature_ro_compat) &
> +	      EXT5_FEATURE_RO_COMPAT_REQD_MASK) != EXT5_FEATURE_RO_COMPAT_REQD ||
> +	     (le32_to_cpu(es->s_feature_compat) &
> +	      EXT5_FEATURE_COMPAT_REQD_MASK) != EXT5_FEATURE_COMPAT_REQD ||
> +	     (le32_to_cpu(es->s_default_mount_opts) &
> +	      EXT5_DEF_MNTOPT_MASK) != EXT5_DEF_MNTOPT)) {
> +		ext4_msg(sb, KERN_ERR, "VFS: Found ext5 filesystem with "
> +			 "missing features.  Run e2fsck?");
> +		goto failed_mount;
> +	}
> +
> +	if (is_ext5_fs(sb))
> +		set_opt(sb, JOURNAL_CHECKSUM);
> +
>  	/* Set defaults before we parse the mount options */
>  	def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
>  	set_opt(sb, INIT_INODE_TABLE);
> @@ -3562,9 +3630,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		goto failed_mount;
>  
>  	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
> -		printk_once(KERN_WARNING "EXT4-fs: Warning: mounting "
> +		printk_once(KERN_WARNING "EXT%d-fs: Warning: mounting "
>  			    "with data=journal disables delayed "
> -			    "allocation and O_DIRECT support!\n");
> +			    "allocation and O_DIRECT support!\n",
> +			    ext4_level(sb));
>  		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
>  			ext4_msg(sb, KERN_ERR, "can't mount with "
>  				 "both data=journal and delalloc");
> @@ -4073,7 +4142,8 @@ no_journal:
>  	EXT4_SB(sb)->rsv_conversion_wq =
>  		alloc_workqueue("ext4-rsv-conversion", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
>  	if (!EXT4_SB(sb)->rsv_conversion_wq) {
> -		printk(KERN_ERR "EXT4-fs: failed to create workqueue\n");
> +		printk(KERN_ERR "EXT%d-fs: failed to create workqueue\n",
> +		       ext4_level(sb));
>  		ret = -ENOMEM;
>  		goto failed_mount4;
>  	}
> @@ -5563,6 +5633,9 @@ static int __init ext4_init_fs(void)
>  		goto out1;
>  	register_as_ext3();
>  	register_as_ext2();
> +	err = register_filesystem(&ext5_fs_type);
> +	if (err)
> +		goto out;
>  	err = register_filesystem(&ext4_fs_type);
>  	if (err)
>  		goto out;
> @@ -5571,6 +5644,7 @@ static int __init ext4_init_fs(void)
>  out:
>  	unregister_as_ext2();
>  	unregister_as_ext3();
> +	unregister_filesystem(&ext4_fs_type);
>  	destroy_inodecache();
>  out1:
>  	ext4_mballoc_ready = 0;
> @@ -5597,6 +5671,7 @@ static void __exit ext4_exit_fs(void)
>  	unregister_as_ext2();
>  	unregister_as_ext3();
>  	unregister_filesystem(&ext4_fs_type);
> +	unregister_filesystem(&ext5_fs_type);
>  	destroy_inodecache();
>  	ext4_exit_mballoc();
>  	ext4_exit_feat_adverts();
> 
> --
> 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
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2
  2014-05-01 23:17 ` [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2 Darrick J. Wong
@ 2014-05-12 14:16   ` Theodore Ts'o
  0 siblings, 0 replies; 11+ messages in thread
From: Theodore Ts'o @ 2014-05-12 14:16 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-ext4

On Thu, May 01, 2014 at 04:17:34PM -0700, Darrick J. Wong wrote:
> The ext4_bg_has_super() function doesn't know about the new rules for
> where backup superblocks go on a sparse_super2 filesystem.  Therefore,
> block bitmap initialization doesn't know that it shouldn't reserve
> space for backups in groups that are never going to contain backups.
> The result of this is e2fsck complaining about the block bitmap being
> incorrect (fortunately not in a way that results in cross-linked
> files), so fix the whole thing.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg
  2014-05-01 23:17 ` [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg Darrick J. Wong
@ 2014-05-12 14:22   ` Theodore Ts'o
  0 siblings, 0 replies; 11+ messages in thread
From: Theodore Ts'o @ 2014-05-12 14:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-ext4

On Thu, May 01, 2014 at 04:17:40PM -0700, Darrick J. Wong wrote:
> On a bigalloc,^flex_bg filesystem, the ext4_valid_block_bitmap
> function fails to convert from blocks to clusters when spot-checking
> the validity of the bitmap block that we've just read from disk.  This
> causes ext4 to think that the bitmap is garbage, which results in the
> block group being taken offline when it's not necessary.  Add in the
> necessary EXT4_B2C() calls to perform the conversions.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] ext4: don't crash when validating block bitmap
  2014-05-01 23:17 ` [PATCH 4/5] ext4: don't crash when validating block bitmap Darrick J. Wong
@ 2014-05-12 14:24   ` Theodore Ts'o
  2014-05-13 22:33     ` Darrick J. Wong
  0 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2014-05-12 14:24 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-ext4

On Thu, May 01, 2014 at 04:17:47PM -0700, Darrick J. Wong wrote:
> If EXT4FS_DEBUG is defined, ext4_validate_block_bitmap is called via
> ext4_count_free_clusters before sb->s_group_info is set up.  When this
> happens, the kernel crashes because group info hasn't been loaded.
> Forego marking the group corrupt for now; not setting BH_Verified
> means we'll revisit the bitmap if something went wrong.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

This shouldn't be necessary that we have this in the ext4 tree, right?

commit 007649375f6af242d5b1df2c15996949714303ba
Author: Azat Khuzhin <a3at.mail@gmail.com>
Date:   Mon Apr 7 10:54:20 2014 -0400

    ext4: initialize multi-block allocator before checking block descriptors
    
    With EXT4FS_DEBUG ext4_count_free_clusters() will call
    ext4_read_block_bitmap() without s_group_info initialized, so we need to
    initialize multi-block allocator before.
    
    ...

						- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] ext4: don't crash when validating block bitmap
  2014-05-12 14:24   ` Theodore Ts'o
@ 2014-05-13 22:33     ` Darrick J. Wong
  0 siblings, 0 replies; 11+ messages in thread
From: Darrick J. Wong @ 2014-05-13 22:33 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

On Mon, May 12, 2014 at 10:24:57AM -0400, Theodore Ts'o wrote:
> On Thu, May 01, 2014 at 04:17:47PM -0700, Darrick J. Wong wrote:
> > If EXT4FS_DEBUG is defined, ext4_validate_block_bitmap is called via
> > ext4_count_free_clusters before sb->s_group_info is set up.  When this
> > happens, the kernel crashes because group info hasn't been loaded.
> > Forego marking the group corrupt for now; not setting BH_Verified
> > means we'll revisit the bitmap if something went wrong.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> This shouldn't be necessary that we have this in the ext4 tree, right?

Err... right, you can drop this patch of mine.

--D

> 
> commit 007649375f6af242d5b1df2c15996949714303ba
> Author: Azat Khuzhin <a3at.mail@gmail.com>
> Date:   Mon Apr 7 10:54:20 2014 -0400
> 
>     ext4: initialize multi-block allocator before checking block descriptors
>     
>     With EXT4FS_DEBUG ext4_count_free_clusters() will call
>     ext4_read_block_bitmap() without s_group_info initialized, so we need to
>     initialize multi-block allocator before.
>     
>     ...
> 
> 						- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-05-13 22:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
2014-05-01 23:17 ` [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem Darrick J. Wong
2014-05-01 23:17 ` [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2 Darrick J. Wong
2014-05-12 14:16   ` Theodore Ts'o
2014-05-01 23:17 ` [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg Darrick J. Wong
2014-05-12 14:22   ` Theodore Ts'o
2014-05-01 23:17 ` [PATCH 4/5] ext4: don't crash when validating block bitmap Darrick J. Wong
2014-05-12 14:24   ` Theodore Ts'o
2014-05-13 22:33     ` Darrick J. Wong
2014-05-01 23:17 ` [PATCH 5/5] ext4: enforce ext5 feature set and mount options Darrick J. Wong
2014-05-02  9:47   ` Lukáš Czerner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.