diff mbox

[SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens

Message ID CAH2r5mv4ZN9dtpmhDk8_enVPwJqPBoewrVBtV6Hv64QE+saj5Q@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French Sept. 22, 2017, 6:47 a.m. UTC
---------- Forwarded message ----------
From: Steve French <smfrench@gmail.com>
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@vger.kernel.org" <linux-cifs@vger.kernel.org>


We were only handling them on CIFS POSIX/Unix mounts.

Fix them for SMB3 (and non-POSIX CIFS) mounts



--
Thanks,

Steve

Comments

Ronnie Sahlberg Sept. 22, 2017, 6:50 a.m. UTC | #1
Looks sane to me.

Rewieved-by: Ronnie Sahlberg <lsahlber@redhat.com>


----- Original Message -----
From: "Steve French" <smfrench@gmail.com>
To: linux-cifs@vger.kernel.org
Sent: Friday, 22 September, 2017 4:47:46 PM
Subject: Fwd: [SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens

---------- Forwarded message ----------
From: Steve French <smfrench@gmail.com>
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@vger.kernel.org" <linux-cifs@vger.kernel.org>


We were only handling them on CIFS POSIX/Unix mounts.

Fix them for SMB3 (and non-POSIX CIFS) mounts



--
Thanks,

Steve
Pavel Shilovsky Sept. 22, 2017, 11:50 p.m. UTC | #2
2017-09-21 23:50 GMT-07:00 Leif Sahlberg <lsahlber@redhat.com>:
> Looks sane to me.
>
> Rewieved-by: Ronnie Sahlberg <lsahlber@redhat.com>
>
>
> ----- Original Message -----
> From: "Steve French" <smfrench@gmail.com>
> To: linux-cifs@vger.kernel.org
> Sent: Friday, 22 September, 2017 4:47:46 PM
> Subject: Fwd: [SMB3] Handle O_SYNC/DSYNC and O_DIRECT flags on SMB3 opens
>
> ---------- Forwarded message ----------
> From: Steve French <smfrench@gmail.com>
> 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@vger.kernel.org" <linux-cifs@vger.kernel.org>
>
>
> We were only handling them on CIFS POSIX/Unix mounts.
>
> Fix them for SMB3 (and non-POSIX CIFS) mounts
>
>
>
> --
> Thanks,
>
> Steve
>
>
> --
> Thanks,
>
> Steve
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Looks good.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From bea99ab733f033c2dcedb8b604963462fa2d4062 Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
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@gmail.com>
CC: Stable <stable@vger.kernel.org>
---
 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