summaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-07-28 08:12:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-03 07:50:43 +0200
commitf547aa20b4f61662ad3e1a2040bb3cc5778f19b0 (patch)
treee0a229dc8adbed3e63086bdde0a8f61d3c8c79a8 /fs/ext4/super.c
parentdc1b4b710fbef5f8f5a41efe35368e9dd07e71cb (diff)
downloadlinux-stable-f547aa20b4f61662ad3e1a2040bb3cc5778f19b0.tar.gz
linux-stable-f547aa20b4f61662ad3e1a2040bb3cc5778f19b0.tar.bz2
linux-stable-f547aa20b4f61662ad3e1a2040bb3cc5778f19b0.zip
ext4: fix check to prevent initializing reserved inodes
commit 5012284700775a4e6e3fbe7eac4c543c4874b559 upstream. Commit 8844618d8aa7: "ext4: only look at the bg_flags field if it is valid" will complain if block group zero does not have the EXT4_BG_INODE_ZEROED flag set. Unfortunately, this is not correct, since a freshly created file system has this flag cleared. It gets almost immediately after the file system is mounted read-write --- but the following somewhat unlikely sequence will end up triggering a false positive report of a corrupted file system: mkfs.ext4 /dev/vdc mount -o ro /dev/vdc /vdc mount -o remount,rw /dev/vdc Instead, when initializing the inode table for block group zero, test to make sure that itable_unused count is not too large, since that is the case that will result in some or all of the reserved inodes getting cleared. This fixes the failures reported by Eric Whiteney when running generic/230 and generic/231 in the the nojournal test case. Fixes: 8844618d8aa7 ("ext4: only look at the bg_flags field if it is valid") Reported-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fc32a67a7a19..6b0c1ea95196 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3103,14 +3103,8 @@ static ext4_group_t ext4_has_uninit_itable(struct super_block *sb)
if (!gdp)
continue;
- if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))
- continue;
- if (group != 0)
+ if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)))
break;
- ext4_error(sb, "Inode table for bg 0 marked as "
- "needing zeroing");
- if (sb_rdonly(sb))
- return ngroups;
}
return group;