[systemd-devel] [PATCH] path-util: Fix path_is_mount_point for files
Martin Pitt
martin.pitt at ubuntu.com
Wed May 27 01:07:09 PDT 2015
Martin Pitt [2015-05-25 21:06 +0200]:
> in 220, path_is_mount_point() now always fails with "-20 ENOTDIR" when
> calling it on files. This is problematic as it's perfectly valid to
> have bind-mounted files; in fact, systemd's machine_id_setup() itself
> creates a /run/machine-id → /etc/machine-id bind mount if /etc is
> read-only at that time (and systemd-machine-id-commit will write it
> once root fs becomes writable).
>
> This was first introduced here:
>
> http://cgit.freedesktop.org/systemd/systemd/commit/?id=27cc6f166
> path-util: fix path_is_mount_point() for symlinks
>
> which added O_DIRECTORY, so that openat() fails with the above error.
> It also replaced path_get_parent() (which works fine for files) with
> name_to_handle_at(fd, "..", ...) which only works for directories.
>
> In fd_is_mount_point() we obviously don't have access to the file name
> any more, and presumably we do want to keep it for efficiently
> implementing the "rm-rf: never cross mount points" commit f25afeb.
This patch fixes this. When writing the new tests I also noticed that
allow_symlink==false was broken, this also gets fixed.
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-path-util-Fix-path_is_mount_point-for-files.patch
Type: text/x-diff
Size: 9430 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150527/776d6283/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150527/776d6283/attachment.sig>
More information about the systemd-devel
mailing list