Re: [PATCH] x86: defconfig: Enable CONFIG_FHANDLE

From: Lennart Poettering
Date: Sun Nov 30 2014 - 20:09:16 EST


On Mon, 01.12.14 01:41, Richard Weinberger (richard@xxxxxx) wrote:

> CC'ing systemd folks.
>
> Lennart, can you please explain why you need CONFIG_FHANDLE for systemd?
> Maybe I'm reading the source horrible wrong.

For two usecases:

a) Being able to detect if something is a mount point. The traditional
way to do this is by stat()ing the dir in question and its parent
and comparing st_dev. That logic is not able to detect bind mounts
however, if destination and the place the mount is at are actually
on the same file system... Thus we check the mount id too, if we
can get our hands on it. This actually fixes real-life
problems. For example time-based recursive clean-up logic in /tmp,
where it is desirable that the clean up stops at
submounts. However, we had reports where the clean-up fucked up
people's home directories because they mounted them for some reason
into some subdir in /tmp and they had /tmp and /home on the same
fs.

b) Because we sometimes want to know the mount options used for
specific file systems. For that you want to correlate
/proc/self/mountinfo with a path in the fs. You can of course try
to do path prefix matching and then fuck things up as soon as
people do weird mounts on top of each other. Or you can use use the
mount id name_to_handle tells you and look it up in
/proc/self/mountinfo, and everything is clean and reliable.

We have no interest in the actual fhandle data. If you give us some
other syscall to figure out the mount id, we'd be delighted to use it
instead.

udev uses the logic described in b) to determine if /dev is a devtmpfs
instance. Since devtmpfs has the same fs magic as any other tmpfs we
cannot use the statfs() magic stuff to detect this case.

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