Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dbf5f20 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Al Viro
Browse files

fcntl: allow to set O_DIRECT flag on pipe



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: default avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 90330e68
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;