Skip to content

Commit

Permalink
fcntl: allow to set O_DIRECT flag on pipe
Browse files Browse the repository at this point in the history
With packetized mode for pipes, it's not possible to set O_DIRECT on pipe file
via sys_fcntl, because of unsupported sanity checks.
Ability to set this flag will be used by CRIU to migrate packetized pipes.

v2:
Fixed typos and mode variable to check.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Stanislav Kinsburskiy authored and Al Viro committed Jan 9, 2016
1 parent 90330e6 commit 0dbf5f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
if (arg & O_NDELAY)
arg |= O_NONBLOCK;

if (arg & O_DIRECT) {
/* Pipe packetized mode is controlled by O_DIRECT flag */
if (!S_ISFIFO(filp->f_inode->i_mode) && (arg & O_DIRECT)) {
if (!filp->f_mapping || !filp->f_mapping->a_ops ||
!filp->f_mapping->a_ops->direct_IO)
return -EINVAL;
Expand Down

0 comments on commit 0dbf5f2

Please sign in to comment.