linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs/smb3: directory sync should not return an error
@ 2018-05-10 16:04 Steve French
  2018-05-10 16:37 ` Jeremy Allison
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Steve French @ 2018-05-10 16:04 UTC (permalink / raw)
  To: CIFS; +Cc: linux-fsdevel, samba-technical

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

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.



-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-directory-sync-should-not-return-an-error.patch --]
[-- Type: text/x-patch, Size: 1477 bytes --]

From 6112a4967573f9a347f7abc02e80423851b73737 Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
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 <smfrench@gmail.com>
CC: Stable <stable@vger.kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-05-10 23:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 16:04 [PATCH] cifs/smb3: directory sync should not return an error Steve French
2018-05-10 16:37 ` Jeremy Allison
2018-05-10 17:11 ` Pavel Shilovsky
2018-05-10 18:48   ` Jeremy Allison
2018-05-10 20:28     ` Steve French
2018-05-10 21:56       ` Steve French
2018-05-10 22:08         ` ronnie sahlberg
2018-05-10 22:12           ` Jeremy Allison
2018-05-10 22:25             ` Steve French
2018-05-10 23:06               ` Jeremy Allison
2018-05-10 21:01 ` ronnie sahlberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).