OSDN Git Service

mke2fs: check that auto-detected blocksize <= sys_page_size
authorYury V. Zaytsev <yury@shurup.com>
Fri, 16 Sep 2011 03:08:52 +0000 (23:08 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 03:46:27 +0000 (23:46 -0400)
commit45792c127645fdb4b665b74dff01748e5db789c5
tree18ffe8ce20b483a954e38b2afcd1e48d18745e08
parent15749d7da9b6242d477801a54164b3d04c2b4102
mke2fs: check that auto-detected blocksize <= sys_page_size

Block size can be specified manually via the -b option or deduced
automatically. Unfortunately, the check that it is still smaller than
the system page size is only performed right after the command line
options are parsed.

Therefore, if buggy or inappropriately installed/configured hardware
hints that larger block sizes have to be used, mkfs will silently create
a file system which can not be mounted on the system in question.

By moving the check beyond the last assignment to blocksize it is now
ensured, that mkfs will issue a warning even if inappropriate blocksize
was auto-detected.

The new behavior can be easily tested, by exporting the following
variables before running mkfs:

    export MKE2FS_DEVICE_SECTSIZE=8192
    export MKE2FS_DEVICE_PHYS_SECTSIZE=8192

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c