Commit 6e70c267 authored by Steve French's avatar Steve French

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: default avatarSteve French <smfrench@gmail.com>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent ae2cd7fb
...@@ -1047,6 +1047,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, ...@@ -1047,6 +1047,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
return rc; return rc;
} }
/*
* Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync()
* is a dummy operation.
*/
static 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, static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
struct file *dst_file, loff_t destoff, struct file *dst_file, loff_t destoff,
size_t len, unsigned int flags) size_t len, unsigned int flags)
...@@ -1181,6 +1193,7 @@ const struct file_operations cifs_dir_ops = { ...@@ -1181,6 +1193,7 @@ const struct file_operations cifs_dir_ops = {
.copy_file_range = cifs_copy_file_range, .copy_file_range = cifs_copy_file_range,
.clone_file_range = cifs_clone_file_range, .clone_file_range = cifs_clone_file_range,
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.fsync = cifs_dir_fsync,
}; };
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment