> On 04/29/2012 01:54 PM, Linux Kernel Mailing List wrote: >> However, a prettier solution exists now thanks to the packetized pipe >> mode. By marking the communication pipe as being packetized (by simply >> setting the O_DIRECT flag), we can always just write the bigger packet >> size, and if user-space does a smaller read, it will just get that >> partial end result and the extra alignment padding will simply be thrown >> away. > +static inline int autofs_prepare_pipe(struct file *pipe) > +{ > + if (!pipe->f_op || !pipe->f_op->write) > + return -EINVAL; > + if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode)) > + return -EINVAL; > + /* We want a packet pipe */ > + pipe->f_flags |= O_DIRECT; > + return 0; > +} > + @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(st err = -EBADF; goto out; } - if (!pipe->f_op || !pipe->f_op->write) { + if (autofs_prepare_pipe(pipe) < 0) { err = -EPIPE; fput(pipe); goto out; I've one more concern. I'm not sure but I think there's some risk still. This packetizing gets applied to all VERSIONS of the autofs PROTOCOL. Which means it will be applied to the lowest supported version (3) TOO, but did that version read whole packets too? Maybe something like the attached should be applied? Thanks, /mjt