Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965580AbbLOPln (ORCPT ); Tue, 15 Dec 2015 10:41:43 -0500 Received: from swsoft-msk-nat.sw.ru ([195.214.232.10]:26861 "EHLO sandbox" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965379AbbLOPlk (ORCPT ); Tue, 15 Dec 2015 10:41:40 -0500 X-Greylist: delayed 1646 seconds by postgrey-1.27 at vger.kernel.org; Tue, 15 Dec 2015 10:41:38 EST Subject: [PATCH v2] fcntl: allow to set O_DIRECT flag on pipe From: Stanislav Kinsburskiy To: bfields@fieldses.org, jlayton@poochiereds.net, viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, criu@openvz.org, linux-kernel@vger.kernel.org Date: Tue, 15 Dec 2015 19:41:31 +0400 Message-ID: <20151215154009.32186.82776.stgit@localhost.localdomain> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1140 Lines: 32 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 --- fs/fcntl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index ee85cd4..350a2c8 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -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; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/