Re: [d_path 0/7] Fixes to d_path: Respin

From: Andreas Gruenbacher
Date: Fri Apr 20 2007 - 12:40:31 EST


On Friday 20 April 2007 17:24, Ulrich Drepper wrote:
> On 4/20/07, Andreas Gruenbacher <agruen@xxxxxxx> wrote:
> > Yes, that one, sorry. The values it obtains that way are not reliable.
>
> Why should the mount point info together with the filesystem type not
> be reliable?

Ah ... I overlooked that fstatvfs() also checks the device number, not only
the name, and so then it can find the right device from that.

So for how glibc uses /proc/mounts in fstatvfs(), hiding unreachable mount
points from /proc/mounts wouldn't improve things. The heuristic already
doesn't work for file descriptors from other namespaces, so it's already
broken unfortunately. A more robust mechanism for glibc to use would be nice;
not sure it would be worth it only for fstatvfs though.

The code also seems to stop at the first matching mount point. You can have
the same device mounted on the same mount point multiple times but with
different mount options, e.g.,

$ dd if=/dev/zero of=/var/tmp/ext2 bs=4096 count=16384
$ mkfs.ext2 -F /var/tmp/ext2
$ mount -o loop /var/tmp/ext2 /mnt
$ mount -o loop,ro /var/tmp/ext2 /mnt
$ tail -n 2 /proc/mounts
/dev/loop0 /mnt ext2 rw 0 0
/dev/loop1 /mnt ext2 ro 0 0

The topmost mount point appears last in /proc/mounts, and so unless I am
overlooking something else, that's another minor problem.

The third problem, as I already tried to argue several times now, is that the
mount points path that /proc/mounts reports may or may not actually exist.
That's a problem for glibc, and you should be one of the first to notice and
acknowledge that. I gave a chroot example that showed that in the current
implementation, you can get pretty random clashes between mounts; there are
other cases with lazy unmounts as well.

> You're trying to find an excuse to break tings, that seems all there is.

Now what makes you think that??

Andreas
-
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/