summaryrefslogtreecommitdiffstats
path: root/src/basic/mount-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-01 12:59:16 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-12-01 12:59:16 +0100
commit976c0478410d3bac9d11278ed024a3cdb1bef749 (patch)
tree5d54dd826b87de4802645921e300c9a9235027f8 /src/basic/mount-util.c
parentsd-bus: validate the message type (#7520) (diff)
downloadsystemd-976c0478410d3bac9d11278ed024a3cdb1bef749.tar.xz
systemd-976c0478410d3bac9d11278ed024a3cdb1bef749.zip
mount-util: tape over name_to_handle_at() flakiness (#7517)
Apparently, the kernel returns EINVAL on NFS4 sometimes, even if we do everything right, let's fallback in that case and find a different approach to determine if something's a mount point. See discussion at: https://github.com/systemd/systemd/issues/7082#issuecomment-348001289
Diffstat (limited to '')
-rw-r--r--src/basic/mount-util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index e32502308a..e394e1adf3 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -183,10 +183,11 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
* real mounts of their own. */
r = name_to_handle_at_loop(fd, filename, &h, &mount_id, flags);
- if (IN_SET(r, -ENOSYS, -EACCES, -EPERM, -EOVERFLOW))
+ if (IN_SET(r, -ENOSYS, -EACCES, -EPERM, -EOVERFLOW, -EINVAL))
/* This kernel does not support name_to_handle_at() at all (ENOSYS), or the syscall was blocked
* (EACCES/EPERM; maybe through seccomp, because we are running inside of a container?), or the mount
- * point is not triggered yet (EOVERFLOW, thinkg nfs4): fall back to simpler logic. */
+ * point is not triggered yet (EOVERFLOW, think nfs4), or some general name_to_handle_at() flakiness
+ * (EINVAL): fall back to simpler logic. */
goto fallback_fdinfo;
else if (r == -EOPNOTSUPP)
/* This kernel or file system does not support name_to_handle_at(), hence let's see if the upper fs
@@ -308,7 +309,7 @@ int path_get_mnt_id(const char *path, int *ret) {
int r;
r = name_to_handle_at_loop(AT_FDCWD, path, NULL, ret, 0);
- if (IN_SET(r, -EOPNOTSUPP, -ENOSYS, -EACCES, -EPERM, -EOVERFLOW)) /* kernel/fs don't support this, or seccomp blocks access, or untriggered mount */
+ if (IN_SET(r, -EOPNOTSUPP, -ENOSYS, -EACCES, -EPERM, -EOVERFLOW, -EINVAL)) /* kernel/fs don't support this, or seccomp blocks access, or untriggered mount, or name_to_handle_at() is flaky */
return fd_fdinfo_mnt_id(AT_FDCWD, path, 0, ret);
return r;