smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
                   struct cifs_sb_info *cifs_sb, const char *full_path,
                   __u32 desired_access, __u32 create_disposition,
-                  __u32 file_attributes, __u32 create_options,
-                  void *data, int command)
+                  __u32 create_options, void *data, int command)
 {
        int rc, tmprc = 0;
        u64 persistent_fid, volatile_fid;
                return -ENOMEM;
 
        rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
-                      desired_access, create_disposition, file_attributes,
-                      create_options, &oplock, NULL);
+                      desired_access, create_disposition, create_options,
+                      &oplock, NULL);
        if (rc) {
                kfree(utf16_path);
                return rc;
                return -ENOMEM;
 
        rc = smb2_open_op_close(xid, tcon, cifs_sb, full_path,
-                               FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0,
-                               smb2_data, SMB2_OP_QUERY_INFO);
+                               FILE_READ_ATTRIBUTES, FILE_OPEN, 0, smb2_data,
+                               SMB2_OP_QUERY_INFO);
        if (rc)
                goto out;
 
           struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name,
-                                 FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
+                                 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
                                  CREATE_NOT_FILE, NULL, SMB2_OP_MKDIR);
 }
 
        dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
        data.Attributes = cpu_to_le32(dosattrs);
        tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name,
-                                  FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
+                                  FILE_WRITE_ATTRIBUTES, FILE_CREATE,
                                   CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
        if (tmprc == 0)
                cifs_i->cifsAttrs = dosattrs;
           struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-                                 0, CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
+                                 CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
                                  NULL, SMB2_OP_DELETE);
 }
 
            struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-                                 0, CREATE_DELETE_ON_CLOSE, NULL,
+                                 CREATE_DELETE_ON_CLOSE, NULL,
                                  SMB2_OP_DELETE);
 }
 
        }
 
        rc = smb2_open_op_close(xid, tcon, cifs_sb, from_name, access,
-                               FILE_OPEN, 0, 0, smb2_to_name, command);
+                               FILE_OPEN, 0, smb2_to_name, command);
 smb2_rename_path:
        kfree(smb2_to_name);
        return rc;
 {
        __le64 eof = cpu_to_le64(size);
        return smb2_open_op_close(xid, tcon, cifs_sb, full_path,
-                                 FILE_WRITE_DATA, FILE_OPEN, 0, 0, &eof,
+                                 FILE_WRITE_DATA, FILE_OPEN, 0, &eof,
                                  SMB2_OP_SET_EOF);
 }
 
        if (IS_ERR(tlink))
                return PTR_ERR(tlink);
        rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path,
-                               FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, 0, buf,
+                               FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
                                SMB2_OP_SET_INFO);
        cifs_put_tlink(tlink);
        return rc;
 
                return -ENOMEM;
 
        rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
-                      FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
+                      FILE_READ_ATTRIBUTES, FILE_OPEN, 0, &oplock, NULL);
        if (rc) {
                kfree(utf16_path);
                return rc;
                return -ENOMEM;
 
        rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
-                      FILE_READ_ATTRIBUTES | FILE_READ_DATA, FILE_OPEN, 0, 0,
+                      FILE_READ_ATTRIBUTES | FILE_READ_DATA, FILE_OPEN, 0,
                       &oplock, NULL);
        kfree(utf16_path);
        if (rc) {
        u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
 
        rc = SMB2_open(xid, tcon, &srch_path, &persistent_fid, &volatile_fid,
-                      FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
+                      FILE_READ_ATTRIBUTES, FILE_OPEN, 0, &oplock, NULL);
        if (rc)
                return rc;
        buf->f_type = SMB2_MAGIC_NUMBER;
 
 int
 SMB2_open(const unsigned int xid, struct cifs_tcon *tcon, __le16 *path,
          u64 *persistent_fid, u64 *volatile_fid, __u32 desired_access,
-         __u32 create_disposition, __u32 file_attributes, __u32 create_options,
-         __u8 *oplock, struct smb2_file_all_info *buf)
+         __u32 create_disposition, __u32 create_options, __u8 *oplock,
+         struct smb2_file_all_info *buf)
 {
        struct smb2_create_req *req;
        struct smb2_create_rsp *rsp;
        int copy_size;
        int rc = 0;
        int num_iovecs = 2;
+       __u32 file_attributes = 0;
 
        cifs_dbg(FYI, "create/open\n");
 
        if (rc)
                return rc;
 
+       if (create_options & CREATE_OPTION_READONLY)
+               file_attributes |= ATTR_READONLY;
+
        req->ImpersonationLevel = IL_IMPERSONATION;
        req->DesiredAccess = cpu_to_le32(desired_access);
        /* File attributes ignored on open (used in create though) */
        req->FileAttributes = cpu_to_le32(file_attributes);
        req->ShareAccess = FILE_SHARE_ALL_LE;
        req->CreateDisposition = cpu_to_le32(create_disposition);
-       req->CreateOptions = cpu_to_le32(create_options);
+       req->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK);
        uni_path_len = (2 * UniStrnlen((wchar_t *)path, PATH_MAX)) + 2;
        req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req)
                        - 8 /* pad */ - 4 /* do not count rfc1001 len field */);
 
 extern int SMB2_open(const unsigned int xid, struct cifs_tcon *tcon,
                     __le16 *path, u64 *persistent_fid, u64 *volatile_fid,
                     __u32 desired_access, __u32 create_disposition,
-                    __u32 file_attributes, __u32 create_options,
-                    __u8 *oplock, struct smb2_file_all_info *buf);
+                    __u32 create_options, __u8 *oplock,
+                    struct smb2_file_all_info *buf);
 extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon,
                     u64 persistent_fid, u64 volatile_fid, u32 opcode,
                     bool is_fsctl, char *in_data, u32 indatalen,