Skip to content

Commit d3c5006

Browse files
raven-aubrauner
authored andcommitted
autofs: fix add autofs_parse_fd()
We are seeing systemd hang on its autofs direct mount at /proc/sys/fs/binfmt_misc. Historically this was due to a mismatch in the communication structure size between a 64 bit kernel and a 32 bit user space and was fixed by making the pipe communication record oriented. During autofs v5 development I decided to stay with the existing usage instead of changing to a packed structure for autofs <=> user space communications which turned out to be a mistake on my part. Problems arose and they were fixed by allowing for the 64 bit to 32 bit size difference in the automount(8) code. Along the way systemd started to use autofs and eventually encountered this problem too. systemd refused to compensate for the length difference insisting it be fixed in the kernel. Fortunately Linus implemented the packetized pipe which resolved the problem in a straight forward and simple way. In the autofs mount api conversion series I inadvertatly dropped the packet pipe flag settings when adding the autofs_parse_fd() function. This patch fixes that omission. Fixes: 546694b ("autofs: add autofs_parse_fd()") Signed-off-by: Ian Kent <raven@themaw.net> Link: https://lore.kernel.org/r/20231023093359.64265-1-raven@themaw.net Tested-by: Anders Roxell <anders.roxell@linaro.org> Cc: Bill O'Donnell <bodonnel@redhat.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dan Carpenter <dan.carpenter@linaro.org> Cc: Anders Roxell <anders.roxell@linaro.org> Cc: Naresh Kamboju <naresh.kamboju@linaro.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> Reported-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 9cf16b3 commit d3c5006

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

fs/autofs/autofs_i.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,20 @@ static inline int autofs_check_pipe(struct file *pipe)
221221
return 0;
222222
}
223223

224-
static inline int autofs_prepare_pipe(struct file *pipe)
224+
static inline void autofs_set_packet_pipe_flags(struct file *pipe)
225225
{
226-
int ret = autofs_check_pipe(pipe);
227-
if (ret < 0)
228-
return ret;
229226
/* We want a packet pipe */
230227
pipe->f_flags |= O_DIRECT;
231228
/* We don't expect -EAGAIN */
232229
pipe->f_flags &= ~O_NONBLOCK;
230+
}
231+
232+
static inline int autofs_prepare_pipe(struct file *pipe)
233+
{
234+
int ret = autofs_check_pipe(pipe);
235+
if (ret < 0)
236+
return ret;
237+
autofs_set_packet_pipe_flags(pipe);
233238
return 0;
234239
}
235240

fs/autofs/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi,
177177
return -EBADF;
178178
}
179179

180+
autofs_set_packet_pipe_flags(pipe);
181+
180182
if (sbi->pipe)
181183
fput(sbi->pipe);
182184

0 commit comments

Comments
 (0)