Whamcloud - gitweb
mke2fs: disallow creating FS on a loop mounted file with no option
authorKazuya Mio <k-mio@sx.jp.nec.com>
Mon, 16 Dec 2013 05:48:12 +0000 (00:48 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Dec 2013 05:48:54 +0000 (00:48 -0500)
commitfbabd5c44c2303501ad79b0e0386fe6436e0e147
tree86f0b8c5ac76eab62f7485cd73a8faff5b0f3c61
parent82896cbe0e83fc084abbe1ae2f043d2ec9058963
mke2fs: disallow creating FS on a loop mounted file with no option

When /etc/mtab is a symlink of /proc/mounts, mke2fs without -FF option
can create a filesystem on the image file that is mounted.
According to mke2fs man page, we should specify -FF option in this case.

This patch protects filesystem from unintended mke2fs caused by human error.

How to reproduce:
  # mke2fs -t ext4 -Fq fs.img
  # mount -o loop fs.img /mnt/mp1
  # mke2fs -t ext4 -Fq fs.img && echo "mke2fs success"
  mke2fs success

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
configure
configure.in
lib/ext2fs/ismounted.c