---------- Forwarded message ---------- From: Steve French <smfrench@xxxxxxxxx> Date: Fri, Sep 22, 2017 at 1:43 AM Subject: [SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens To: "linux-cifs@xxxxxxxxxxxxxxx" <linux-cifs@xxxxxxxxxxxxxxx> We were only handling them on CIFS POSIX/Unix mounts. Fix them for SMB3 (and non-POSIX CIFS) mounts -- Thanks, Steve -- Thanks, Steve
From bea99ab733f033c2dcedb8b604963462fa2d4062 Mon Sep 17 00:00:00 2001 From: Steve French <smfrench@xxxxxxxxx> Date: Fri, 22 Sep 2017 01:40:27 -0500 Subject: [PATCH] [SMB3] Ensure that O_SYNC/O_DSYNC and O_DIRECT flags are honored on SMB3 mounts Signed-off-by: Steve French <smfrench@xxxxxxxxx> CC: Stable <stable@xxxxxxxxxxxxxxx> --- fs/cifs/file.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8223119..92fdf9c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -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; -- 2.7.4