From patchwork Fri Sep 22 06:47:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 9965263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E61E26020C for ; Fri, 22 Sep 2017 06:48:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D634A297D4 for ; Fri, 22 Sep 2017 06:48:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB159297D6; Fri, 22 Sep 2017 06:48:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FEB0297D4 for ; Fri, 22 Sep 2017 06:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbdIVGsI (ORCPT ); Fri, 22 Sep 2017 02:48:08 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:49999 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637AbdIVGsH (ORCPT ); Fri, 22 Sep 2017 02:48:07 -0400 Received: by mail-pf0-f169.google.com with SMTP id l188so139665pfc.6 for ; Thu, 21 Sep 2017 23:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Ao1TNi8sTd7AiWbdDxB1D7zKlLmyyVFq+Fln02enuKY=; b=JLW70oS0vMRnKYXZCU7OarHQUSoWxlpE8zPyvYC9lqmTwayzXfCBxK/l97c/vO0OjR qzACsgxi4ROoj0ej45bdiuebh4b9u8sd4uoMoXhUN6kFHLBD8g1c9UEpgN0Zv9IBTNDT aFPCTu+lTtDXfTPsoVXx+//UzQAhSY0Nk9XP1szaEmB44KTX2gXqXEYYeer2OcirHpgt Nek0BDc/ibKHUS3aRLZDMkZXpibP5H18LaVS+VaRzLVKVMLas3+PRKtNhqjObYN5s6IS 10GJp9/daRNUoVoujliMC0NAMWl/tkpTiH2ca8QPQm6It/psMq4CXpZN2EzjimV6w72M FYOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Ao1TNi8sTd7AiWbdDxB1D7zKlLmyyVFq+Fln02enuKY=; b=Ox13jeda6wsk7G2ox2TLatb94ValkVpP1n1vgGi7IfEu4VbFmVkToSqulmMJELvKNI xuVQA0JEsL2qT4wiowFnJTpjyGNrJ27mRTvXmWT8xTMvFfmLRWPr+2mtGUB72dEYdjhy hawKTPJH3/Viwwul8ArjCLY/7El3qy9btJaFzmvf5yLcik8RtslzH6u7VCdq2s4OwQfw sK/jBYFYvhbxM+z7pXNZs8VFvq3HX6KgfW4+3TnX4cI0XFcVEjV/ujFy6TMv5ZTtDKLj An/dUC60DhVeJocvVlYgBm21A4Db5ok8Cj6UqbXUT3BwwKh4DA2JlEusZg/PyQLgaAwm Glkg== X-Gm-Message-State: AHPjjUiKxIL8ike9S0Hp/GvODTfIBlqiK44CUOIHSGTlFGEaOvqpfD34 PcY5fHpE2vIVG29BlcPLVjMAIOf3ilVPD9aHw3iyVg== X-Google-Smtp-Source: AOwi7QCG8o2A/eTpGMA/HnqiuQMqGZ0EbOsRljmKwz2i6GtAgKYyUh5+yPaGMdaUbMB6gqQXIxxwEYVdCxwc4pjvwVA= X-Received: by 10.101.72.65 with SMTP id i1mr8453408pgs.184.1506062886781; Thu, 21 Sep 2017 23:48:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.142.1 with HTTP; Thu, 21 Sep 2017 23:47:46 -0700 (PDT) In-Reply-To: References: From: Steve French Date: Fri, 22 Sep 2017 01:47:46 -0500 Message-ID: Subject: Fwd: [SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens To: "linux-cifs@vger.kernel.org" Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ---------- Forwarded message ---------- From: Steve French Date: Fri, Sep 22, 2017 at 1:43 AM Subject: [SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens To: "linux-cifs@vger.kernel.org" We were only handling them on CIFS POSIX/Unix mounts. Fix them for SMB3 (and non-POSIX CIFS) mounts Reviewed-by: Pavel Shilovsky --- Thanks, Steve From bea99ab733f033c2dcedb8b604963462fa2d4062 Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 22 Sep 2017 01:40:27 -0500 Subject: [PATCH] [SMB3] Ensure that O_SYNC/O_DSYNC and O_DIRECT flags are honored on SMB3 mounts Signed-off-by: Steve French CC: Stable --- fs/cifs/file.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8223119..92fdf9c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -224,6 +224,13 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, if (backup_cred(cifs_sb)) create_options |= CREATE_OPEN_BACKUP_INTENT; + /* O_SYNC also has bit for O_DSYNC so following check picks up either */ + if (f_flags & O_SYNC) + create_options |= CREATE_WRITE_THROUGH; + + if (f_flags & O_DIRECT) + create_options |= CREATE_NO_BUFFER; + oparms.tcon = tcon; oparms.cifs_sb = cifs_sb; oparms.desired_access = desired_access; -- 2.7.4