Re: /etc/mtab and per-process namespaces

From: Michael Tokarev
Date: Tue Oct 04 2005 - 14:49:19 EST


Christoph Hellwig wrote:
I suspect not one cares about /etc/mtab. It's a pretty horrible
interface. Use /proc/self/mounts if your care about the mount table
for your current namespace, it's guranteed uptodate.

Well, it's uptodate, but it isn't the same as mtab. Like:

/tmp/test on /mnt/test type ext2 (rw,loop=/dev/loop/0)
(mtab), vs
/dev/loop/0 /mnt/test ext2 rw 0 0

or:

tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
vs
tmpfs /dev tmpfs rw 0 0

ie, sometimes, mtab format is more useful. Also, with the
above example with loop device, umount is able to delete the
loop device for loop-mounts.

Another funky example:

losetup /dev/loop/0 /tmp/test
cd /dev/loop
mount 0 /mnt/test

now, mtab shows:

/dev/loop/0 /mnt/test ext2 rw 0 0

while /proc/mounts shows

0 /mnt/test ext2 rw 0 0

which is rather useless.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/