From patchwork Tue Dec 15 15:14:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kinsburskiy X-Patchwork-Id: 7855761 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2DDD2BEEE1 for ; Tue, 15 Dec 2015 15:59:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BAA6202A1 for ; Tue, 15 Dec 2015 15:59:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96DE82037C for ; Tue, 15 Dec 2015 15:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964990AbbLOP7i (ORCPT ); Tue, 15 Dec 2015 10:59:38 -0500 Received: from swsoft-msk-nat.sw.ru ([195.214.232.10]:50001 "EHLO sandbox" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964985AbbLOP7i (ORCPT ); Tue, 15 Dec 2015 10:59:38 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by sandbox (8.14.8/8.14.8) with ESMTP id tBFFE451015524; Tue, 15 Dec 2015 19:14:06 +0400 Subject: [PATCH] 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, linux-kernel@vger.kernel.org, devel@criu.org Date: Tue, 15 Dec 2015 19:14:04 +0400 Message-ID: <20151215151325.15499.65499.stgit@localhost.localdomain> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With packetized mode for pipes, it's not possible to set O_DIRECT on pipe file via sys_fcntl, because of unsupported (by pipes) sanity checks. Ability to set this flag will be used by CRIU to migrate packetized pipes. Signed-off-by: Stanislav Kinsburskiy --- fs/fcntl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/fcntl.c b/fs/fcntl.c index ee85cd4..4463a87 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 (!IS_FIFO(f->f_mode) && (arg & O_DIRECT)) { if (!filp->f_mapping || !filp->f_mapping->a_ops || !filp->f_mapping->a_ops->direct_IO) return -EINVAL;