Re: [PATCH 13/14] lib/ismounted: detect loopback mounts

Karel Zak
2012-12-19T15:56:27Z

On Sun, Dec 16, 2012 at 10:44:01AM +0000, Sami Kerola wrote:
> While double checking the minix changes worked I noticed fsck.minix not
> to abort check if the file system was mounted using loopback device. The
> commands before this commit which one needs to reproduce the issue are:
>
> dd if=/dev/zero count=100 of=minixfs
> ./mkfs.minix ./minixfs
> mkdir x
> ./mount ./minixfs x
> ./fsck.minix minixfs

Nice catch, although I have doubts that this is expected way how use
fsck ;-)

> Neither did that appear, nor the fsck check got to be aborted. It seems
> the generic fsck, and mkswap had same problem as they rely on
> is_mounted().

fsck(8) uses libmount and this use case (fsck <fs image>) is ignored
there. Not sure if we want to support it...

(It's not so easy, because you can use --offset and --sizelimit in losetup,
and you need these information to (reliable) found connection between
the image and a filesystem. It's already implemented in libmount,
but it seems like overkill for fsck. I'll think about it.... :-)

> lib/Makemodule.am | 1 +
> lib/ismounted.c | 8 ++++++--
> 2 files changed, 7 insertions(+), 2 deletions(-)

I have applied a little different solution. Thanks.

Karel

--
Karel Zak <kzak@redhat.com>