SMB3: Don't ignore O_SYNC/O_DSYNC and O_DIRECT flags
authorSteve French <smfrench@gmail.com>
Fri, 22 Sep 2017 06:40:27 +0000 (01:40 -0500)
committerSteve French <smfrench@gmail.com>
Sat, 23 Sep 2017 00:47:17 +0000 (19:47 -0500)
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>
fs/cifs/file.c

index 8223119191634f1ffd5f926d470ad80c00082851..92fdf9c35de2153fd6f008c4d1306ead6d806c89 100644 (file)
@@ -224,6 +224,13 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
        if (backup_cred(cifs_sb))
                create_options |= CREATE_OPEN_BACKUP_INTENT;
 
+       /* O_SYNC also has bit for O_DSYNC so following check picks up either */
+       if (f_flags & O_SYNC)
+               create_options |= CREATE_WRITE_THROUGH;
+
+       if (f_flags & O_DIRECT)
+               create_options |= CREATE_NO_BUFFER;
+
        oparms.tcon = tcon;
        oparms.cifs_sb = cifs_sb;
        oparms.desired_access = desired_access;