diff mbox series

[SMB3] smb3: send backup intent on compounded query info

Message ID CAH2r5mtFZHtu2RFTfoL5-rLmujKQphK=89a_yXJ4MTWeXV3Qdw@mail.gmail.com
State New
Headers show
Series [SMB3] smb3: send backup intent on compounded query info | expand

Commit Message

Steve French Oct. 19, 2018, 6:11 a.m. UTC
When mounting with backupuid set, we should be setting
CREATE_OPEN_BACKUP_INTENT flag on compounded opens as well,
especially the case of compounded smb2_query_path_info.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2inode.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

     *symlink = false;
@@ -301,16 +302,20 @@ smb2_query_path_info(const unsigned int xid,
struct cifs_tcon *tcon,
                 GFP_KERNEL);
     if (smb2_data == NULL)
         return -ENOMEM;
+    if (backup_cred(cifs_sb))
+        create_options |= CREATE_OPEN_BACKUP_INTENT;

     rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
-                  FILE_READ_ATTRIBUTES, FILE_OPEN, 0,
+                  FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,
                   smb2_data, SMB2_OP_QUERY_INFO);
     if (rc == -EOPNOTSUPP) {
         *symlink = true;
+        create_options |= OPEN_REPARSE_POINT;
+
         /* Failed on a symbolic link - query a reparse point info */
         rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
                       FILE_READ_ATTRIBUTES, FILE_OPEN,
-                      OPEN_REPARSE_POINT, smb2_data,
+                      create_options, smb2_data,
                       SMB2_OP_QUERY_INFO);
     }
     if (rc)

Comments

ronnie sahlberg Oct. 19, 2018, 6:51 a.m. UTC | #1
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
On Fri, Oct 19, 2018 at 4:11 PM Steve French <smfrench@gmail.com> wrote:
>
> When mounting with backupuid set, we should be setting
> CREATE_OPEN_BACKUP_INTENT flag on compounded opens as well,
> especially the case of compounded smb2_query_path_info.
>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/smb2inode.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
> index 50d4a9afb36a..9e7ef7ec2d70 100644
> --- a/fs/cifs/smb2inode.c
> +++ b/fs/cifs/smb2inode.c
> @@ -293,6 +293,7 @@ smb2_query_path_info(const unsigned int xid,
> struct cifs_tcon *tcon,
>  {
>      int rc;
>      struct smb2_file_all_info *smb2_data;
> +    __u32 create_options = 0;
>
>      *adjust_tz = false;
>      *symlink = false;
> @@ -301,16 +302,20 @@ smb2_query_path_info(const unsigned int xid,
> struct cifs_tcon *tcon,
>                  GFP_KERNEL);
>      if (smb2_data == NULL)
>          return -ENOMEM;
> +    if (backup_cred(cifs_sb))
> +        create_options |= CREATE_OPEN_BACKUP_INTENT;
>
>      rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
> -                  FILE_READ_ATTRIBUTES, FILE_OPEN, 0,
> +                  FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,
>                    smb2_data, SMB2_OP_QUERY_INFO);
>      if (rc == -EOPNOTSUPP) {
>          *symlink = true;
> +        create_options |= OPEN_REPARSE_POINT;
> +
>          /* Failed on a symbolic link - query a reparse point info */
>          rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
>                        FILE_READ_ATTRIBUTES, FILE_OPEN,
> -                      OPEN_REPARSE_POINT, smb2_data,
> +                      create_options, smb2_data,
>                        SMB2_OP_QUERY_INFO);
>      }
>      if (rc)
>
> --
> Thanks,
>
> Steve
diff mbox series

Patch

From 452e4b304ef0ad043193202004997da998d045a7 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 19 Oct 2018 00:32:41 -0500
Subject: [PATCH 1/2] smb3: send backup intent on compounded query info

When mounting with backupuid set, we should be setting
CREATE_OPEN_BACKUP_INTENT flag on compounded opens as well,
especially the case of compounded smb2_query_path_info.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2inode.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 50d4a9afb36a..9e7ef7ec2d70 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -293,6 +293,7 @@  smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
 {
 	int rc;
 	struct smb2_file_all_info *smb2_data;
+	__u32 create_options = 0;
 
 	*adjust_tz = false;
 	*symlink = false;
@@ -301,16 +302,20 @@  smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
 			    GFP_KERNEL);
 	if (smb2_data == NULL)
 		return -ENOMEM;
+	if (backup_cred(cifs_sb))
+		create_options |= CREATE_OPEN_BACKUP_INTENT;
 
 	rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
-			      FILE_READ_ATTRIBUTES, FILE_OPEN, 0,
+			      FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,
 			      smb2_data, SMB2_OP_QUERY_INFO);
 	if (rc == -EOPNOTSUPP) {
 		*symlink = true;
+		create_options |= OPEN_REPARSE_POINT;
+
 		/* Failed on a symbolic link - query a reparse point info */
 		rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
 				      FILE_READ_ATTRIBUTES, FILE_OPEN,
-				      OPEN_REPARSE_POINT, smb2_data,
+				      create_options, smb2_data,
 				      SMB2_OP_QUERY_INFO);
 	}
 	if (rc)
-- 
2.17.1