diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index 244f18cdf23c..8c1d587b3eef 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -221,15 +221,20 @@ static inline int autofs_check_pipe(struct file *pipe) return 0; } +static inline void autofs_set_packet_pipe_flags(struct file *pipe) +{ + /* We want a packet pipe */ + pipe->f_flags |= O_DIRECT; + /* We don't expect -EAGAIN */ + pipe->f_flags &= ~O_NONBLOCK; +} + static inline int autofs_prepare_pipe(struct file *pipe) { int ret = autofs_check_pipe(pipe); if (ret < 0) return ret; - /* We want a packet pipe */ - pipe->f_flags |= O_DIRECT; - /* We don't expect -EAGAIN */ - pipe->f_flags &= ~O_NONBLOCK; + autofs_set_packet_pipe_flags(pipe); return 0; } diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index 6d2e01c9057d..a3d62acc293a 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -177,6 +177,8 @@ static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi, return -EBADF; } + autofs_set_packet_pipe_flags(pipe); + if (sbi->pipe) fput(sbi->pipe);