_scratch_mkfs_sized only receive integer number of bytes as a valid input. But if the MKFS_OPTIONS variable exists, it will use the value of block size in MKFS_OPTIONS to override input. In case of MKFS_OPTIONS="-b 4k", would result in blocksize=4 but not 4096. This will give errors to ext2/3/4 etc, and brings potential bugs to xfs or btrfs. This patch depends on patch ("common/config: add _check_mkfs_block_options"). Signed-off-by: An Long <lan@xxxxxxxx> --- common/rc | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/common/rc b/common/rc index 3c072c16..8b8c3b51 100644 --- a/common/rc +++ b/common/rc @@ -1036,21 +1036,7 @@ _scratch_mkfs_sized() local blocksize=$2 local def_blksz - case $FSTYP in - xfs) - def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?size= ?+([0-9]+).*/\1/p'` - ;; - btrfs) - def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+).*/\1/p'` - ;; - ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs) - def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+).*/\1/p'` - ;; - jfs) - def_blksz=4096 - ;; - esac - + [ -n "$FS_BLOCK_SIZE" ] && def_blksz=$FS_BLOCK_SIZE [ -n "$def_blksz" ] && blocksize=$def_blksz [ -z "$blocksize" ] && blocksize=4096 -- 2.35.3