aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2018-05-10 11:59:37 -0400
committerSteve French <smfrench@gmail.com>2018-05-10 20:21:14 -0400
commit6e70c267e68d77679534dcf4aaf84e66f2cf1425 (patch)
tree18dbbc4fd655506f31bb8586a4c64eacf3b67893
parentae2cd7fb478b8da707906ee1706ae1379968a8f9 (diff)
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> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
-rw-r--r--fs/cifs/cifsfs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f715609b13f3..5a5a0158cc8f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1047,6 +1047,18 @@ out:
1047 return rc; 1047 return rc;
1048} 1048}
1049 1049
1050/*
1051 * Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync()
1052 * is a dummy operation.
1053 */
1054static int cifs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1055{
1056 cifs_dbg(FYI, "Sync directory - name: %pD datasync: 0x%x\n",
1057 file, datasync);
1058
1059 return 0;
1060}
1061
1050static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off, 1062static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
1051 struct file *dst_file, loff_t destoff, 1063 struct file *dst_file, loff_t destoff,
1052 size_t len, unsigned int flags) 1064 size_t len, unsigned int flags)
@@ -1181,6 +1193,7 @@ const struct file_operations cifs_dir_ops = {
1181 .copy_file_range = cifs_copy_file_range, 1193 .copy_file_range = cifs_copy_file_range,
1182 .clone_file_range = cifs_clone_file_range, 1194 .clone_file_range = cifs_clone_file_range,
1183 .llseek = generic_file_llseek, 1195 .llseek = generic_file_llseek,
1196 .fsync = cifs_dir_fsync,
1184}; 1197};
1185 1198
1186static void 1199static void