Skip to content

Commit 6e70c26

Browse files
committed
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 <[email protected]> CC: Stable <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent ae2cd7f commit 6e70c26

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/cifs/cifsfs.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
10471047
return rc;
10481048
}
10491049

1050+
/*
1051+
* Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync()
1052+
* is a dummy operation.
1053+
*/
1054+
static 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+
10501062
static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
10511063
struct file *dst_file, loff_t destoff,
10521064
size_t len, unsigned int flags)
@@ -1181,6 +1193,7 @@ const struct file_operations cifs_dir_ops = {
11811193
.copy_file_range = cifs_copy_file_range,
11821194
.clone_file_range = cifs_clone_file_range,
11831195
.llseek = generic_file_llseek,
1196+
.fsync = cifs_dir_fsync,
11841197
};
11851198

11861199
static void

0 commit comments

Comments
 (0)