diff options
-rw-r--r-- | misc/ChangeLog | 5 | ||||
-rw-r--r-- | misc/mke2fs.c | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 4a96f75b..3b57d0ce 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2007-05-22 Theodore Tso <tytso@mit.edu> + + * mke2fs.c (PRS): Add sanity check if the inode size * inode count + is bigger than the filesystem size. + 2007-05-18 Theodore Tso <tytso@mit.edu> * mke2fs.c (main): Save the raid stride to the superblock diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 0a371379..737e3da5 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1489,6 +1489,20 @@ static void PRS(int argc, char *argv[]) ((__u64) fs_param.s_blocks_count * blocksize) / inode_ratio; + if ((((long long)fs_param.s_inodes_count) * + (inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE)) >= + (((long long)fs_param.s_blocks_count) * + EXT2_BLOCK_SIZE(&fs_param))) { + com_err(program_name, 0, _("inode_size (%u) * inodes_count " + "(%u) too big for a\n\t" + "filesystem with %lu blocks, " + "specify higher inode_ratio (-i)\n\t" + "or lower inode count (-N).\n"), + inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE, + fs_param.s_inodes_count, fs_param.s_blocks_count); + exit(1); + } + /* * Calculate number of blocks to reserve */ |