summaryrefslogtreecommitdiff
path: root/src/core/automount.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2019-02-08 09:44:06 +1100
committerLennart Poettering <lennart@poettering.net>2019-02-08 10:33:26 +0100
commit1cae151d8e38d4017ccd65ed12c459774e537bb2 (patch)
treef0dc766f06de731ddd10054b7ee4c285bb23411e /src/core/automount.c
parenteb7e35149600f6141e01808115859397c190bff1 (diff)
downloadsystemd-1cae151d8e38d4017ccd65ed12c459774e537bb2.tar.gz
automount: don't pass non-blocking pipe to kernel.
Creating a pipe with O_NONBLOCK causes both the read and the write end to be marked as non-blocking. The "write" end is passed to the kernel autofs module, and it does not expect a non-blocking pipe. If it gets -EAGAIN when trying to write (which is unlikely, but not completely impossible), it will close the write end of the pipe, which leads to unexpected errors. So change the code to only set O_NONBLOCK on the "read" end of the pipe. This is the only end that systemd interacts with, so the only end it should be configuring.
Diffstat (limited to 'src/core/automount.c')
-rw-r--r--src/core/automount.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 6db13ab08f..6a8373920e 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -578,10 +578,13 @@ static void automount_enter_waiting(Automount *a) {
goto fail;
}
- if (pipe2(p, O_NONBLOCK|O_CLOEXEC) < 0) {
+ if (pipe2(p, O_CLOEXEC) < 0) {
r = -errno;
goto fail;
}
+ r = fd_nonblock(p[0], true);
+ if (r < 0)
+ goto fail;
xsprintf(options, "fd=%i,pgrp="PID_FMT",minproto=5,maxproto=5,direct", p[1], getpgrp());
xsprintf(name, "systemd-"PID_FMT, getpid_cached());