From patchwork Thu May 10 16:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10392039 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 C0E4060236 for ; Thu, 10 May 2018 16:04:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE2BD1FF2D for ; Thu, 10 May 2018 16:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1AE02236A; Thu, 10 May 2018 16:04:40 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 3D44C1FF2D for ; Thu, 10 May 2018 16:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966305AbeEJQEj (ORCPT ); Thu, 10 May 2018 12:04:39 -0400 Received: from mail-pl0-f42.google.com ([209.85.160.42]:46511 "EHLO mail-pl0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965049AbeEJQEi (ORCPT ); Thu, 10 May 2018 12:04:38 -0400 Received: by mail-pl0-f42.google.com with SMTP id 59-v6so1557673plc.13; Thu, 10 May 2018 09:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=mES/eN2wp+XE+IzEhVl1y9nJVU+/B4PnTTdKZx0Q4As=; b=ClFGUmI/NjyNHWyxR0G/yUjcnxRz8jGsV9feKHUIbLuaeJQLvzsuqJhH16Vdzy4vHz uHdyWc24mEBrEXIGycKqeDiHlxKSm43pY4CZO6+4n7X362OVCrQ2yRT3pLUPiNBs8KUn RWRUQb1I0Eoz8mGBjYLQGKfAs3GrCVRnWCRWRabSiRYFtpdJuN5PMktQAWiiReqsYKEe WlaTbFKWB7+N/GLE2sg2PFEEAGCmMxHMgHtFkV6sJC9IlbFkKt3HkKlV21D5EFgjfrDR xUZ5VLTnLX54lzmR4ztYxe3Q2x7nKZhMTe74wpzd/85zF5NM/y8JRYzR2XjFiF8Y9EeZ g/VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=mES/eN2wp+XE+IzEhVl1y9nJVU+/B4PnTTdKZx0Q4As=; b=H0I1B8OcxFtqjMCzYIAxjjIlz/w9bDGTlotiY5Qr+emfdYTjYVCbxZ5FksA4vXBzhM kMwn1Z3dX/1MxyTgP44ZIS5EL33iceEjztn6JUVe9YhtfwJl05XHQTa4f1R0M57DSrRp qc5Y7rZsLQDq7t6SXENAIG1nlH2AJ5ls8Cx/uZgK2oKSdni2VeGw59J/9m2jCRyS9ox2 aInQda8yzEsej/6tDUdahwJrlYcnNLvzEeqUAiHr1Rf/z9jwdym9V8+GqcWubjEvqR7c Z6+SemdVcP8PTc/KfAw+qgVO6I2OuOQfHK3Pd9NwP71fJ2Ru7X1UyLcimNujjU7f+BiC dscQ== X-Gm-Message-State: ALKqPwdlk8mNwXmfM8rEhvnXi6tKDWqQK7NdnbYtRxr1XFOpJ1kqyDr4 zCFZLP0zuQL+GcVKsEUGme3KlvJEd/FDsRLm84Qronxw X-Google-Smtp-Source: AB8JxZoaaX17uJERxlyyyfdnf+KrF6sPxd8RIoejYzQ7sKJmmujt5SaMJvwA8hDPpysdvms1UrN9452/wZEaX3+tA8E= X-Received: by 2002:a17:902:8541:: with SMTP id d1-v6mr2017499plo.106.1525968277862; Thu, 10 May 2018 09:04:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.189.143 with HTTP; Thu, 10 May 2018 09:04:14 -0700 (PDT) From: Steve French Date: Thu, 10 May 2018 11:04:14 -0500 Message-ID: Subject: [PATCH] cifs/smb3: directory sync should not return an error To: CIFS Cc: linux-fsdevel , samba-technical 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 As with NFS, which ignores sync on directory handles, fsync on a directory handle is a noop for CIFS/SMB3. Do not return an error on it. It breaks some database apps otherwise. Reviewed-by: Pavel Shilovsky Reviewed-by: Ronnie Sahlberg From 6112a4967573f9a347f7abc02e80423851b73737 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 10 May 2018 10:59:37 -0500 Subject: [PATCH] smb3: directory sync should not return an error As with NFS, which ignores sync on directory handles, fsync on a directory handle is a noop for CIFS/SMB3. Do not return an error on it. It breaks some database apps otherwise. Signed-off-by: Steve French CC: Stable --- fs/cifs/cifsfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ed8e181927d6..8e41186d9923 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1049,6 +1049,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, return rc; } +/* + * Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync() + * is a dummy operation. + */ +int cifs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync) +{ + cifs_dbg(FYI, "Sync directory - name: %pD datasync: 0x%x\n", + file, datasync); + + return 0; +} + static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off, struct file *dst_file, loff_t destoff, size_t len, unsigned int flags) @@ -1183,6 +1195,7 @@ const struct file_operations cifs_dir_ops = { .copy_file_range = cifs_copy_file_range, .clone_file_range = cifs_clone_file_range, .llseek = generic_file_llseek, + .fsync = cifs_dir_fsync, }; static void -- 2.17.0