/* If Open reported that we actually created a file
                then we now have to set the mode if possible */
                if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
-                       (oplock & CIFS_CREATE_ACTION))
+                       (oplock & CIFS_CREATE_ACTION)) {
+                       mode &= ~current->fs->umask;
                        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
                                        (__u64)current->fsuid,
                                        cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        }
-               else {
+               } else {
                        /* BB implement mode setting via Windows security
                           descriptors e.g. */
                        /* CIFSSMBWinSetPerms(xid,pTcon,path,mode,-1,-1,nls);*/
        if (full_path == NULL)
                rc = -ENOMEM;
        else if (pTcon->ses->capabilities & CAP_UNIX) {
+               mode &= ~current->fs->umask;
                if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                        rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
                                mode, (__u64)current->fsuid,
 
                  * failed to get it from the server or was set bogus */ 
                if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
                                direntry->d_inode->i_nlink = 2; 
-               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
+               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
+                       mode &= ~current->fs->umask;
                        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path,
                                                    mode,
                                                    cifs_sb->mnt_cifs_flags & 
                                                    CIFS_MOUNT_MAP_SPECIAL_CHR);
                        }
-               else {
+               } else {
                        /* BB to be implemented via Windows secrty descriptors
                           eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
                                                 -1, -1, local_nls); */