Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] fix posix open regression

+44 -36
+7 -7
fs/cifs/dir.c
··· 225 225 if (!(oflags & FMODE_READ)) 226 226 write_only = true; 227 227 228 + mode &= ~current_umask(); 228 229 rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, 229 230 pnetfid, presp_data, &oplock, full_path, 230 231 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ··· 311 310 return -ENOMEM; 312 311 } 313 312 314 - mode &= ~current_umask(); 315 313 if (oplockEnabled) 316 314 oplock = REQ_OPLOCK; 317 315 ··· 336 336 else /* success, no need to query */ 337 337 goto cifs_create_set_dentry; 338 338 } else if ((rc != -EIO) && (rc != -EREMOTE) && 339 - (rc != -EOPNOTSUPP)) /* path not found or net err */ 339 + (rc != -EOPNOTSUPP) && (rc != -EINVAL)) 340 340 goto cifs_create_out; 341 341 /* else fallthrough to retry, using older open call, this is 342 342 case where server does not support this SMB level, and ··· 609 609 int xid; 610 610 int rc = 0; /* to get around spurious gcc warning, set to zero here */ 611 611 int oplock = 0; 612 - int mode; 613 612 __u16 fileHandle = 0; 614 613 bool posix_open = false; 615 614 struct cifs_sb_info *cifs_sb; ··· 659 660 660 661 if (pTcon->unix_ext) { 661 662 if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && 662 - (nd->flags & LOOKUP_OPEN)) { 663 + (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) { 663 664 if (!((nd->intent.open.flags & O_CREAT) && 664 665 (nd->intent.open.flags & O_EXCL))) { 665 - mode = nd->intent.open.create_mode & 666 - ~current_umask(); 667 666 rc = cifs_posix_open(full_path, &newInode, 668 - parent_dir_inode->i_sb, mode, 667 + parent_dir_inode->i_sb, 668 + nd->intent.open.create_mode, 669 669 nd->intent.open.flags, &oplock, 670 670 &fileHandle, xid); 671 671 /* ··· 679 681 */ 680 682 if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) 681 683 posix_open = true; 684 + else 685 + pTcon->broken_posix_open = true; 682 686 } 683 687 } 684 688 if (!posix_open)
+37 -29
fs/cifs/file.c
··· 130 130 struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) 131 131 { 132 132 133 - file->private_data = kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 134 - if (file->private_data == NULL) 135 - return -ENOMEM; 136 - pCifsFile = cifs_init_private(file->private_data, inode, file, netfid); 137 133 write_lock(&GlobalSMBSeslock); 138 134 139 135 pCifsInode = CIFS_I(file->f_path.dentry->d_inode); ··· 178 182 filemap_fdatawrite (which does not seem necessary */ 179 183 write_unlock(&GlobalSMBSeslock); 180 184 return 0; 185 + } 186 + 187 + static struct cifsFileInfo * 188 + cifs_fill_filedata(struct file *file) 189 + { 190 + struct list_head *tmp; 191 + struct cifsFileInfo *pCifsFile = NULL; 192 + struct cifsInodeInfo *pCifsInode = NULL; 193 + 194 + /* search inode for this file and fill in file->private_data */ 195 + pCifsInode = CIFS_I(file->f_path.dentry->d_inode); 196 + read_lock(&GlobalSMBSeslock); 197 + list_for_each(tmp, &pCifsInode->openFileList) { 198 + pCifsFile = list_entry(tmp, struct cifsFileInfo, flist); 199 + if ((pCifsFile->pfile == NULL) && 200 + (pCifsFile->pid == current->tgid)) { 201 + /* mode set in cifs_create */ 202 + 203 + /* needed for writepage */ 204 + pCifsFile->pfile = file; 205 + file->private_data = pCifsFile; 206 + break; 207 + } 208 + } 209 + read_unlock(&GlobalSMBSeslock); 210 + 211 + if (file->private_data != NULL) { 212 + return pCifsFile; 213 + } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 214 + cERROR(1, ("could not find file instance for " 215 + "new file %p", file)); 216 + return NULL; 181 217 } 182 218 183 219 /* all arguments to this function must be checked for validity in caller */ ··· 286 258 struct cifsTconInfo *tcon; 287 259 struct cifsFileInfo *pCifsFile; 288 260 struct cifsInodeInfo *pCifsInode; 289 - struct list_head *tmp; 290 261 char *full_path = NULL; 291 262 int desiredAccess; 292 263 int disposition; ··· 297 270 cifs_sb = CIFS_SB(inode->i_sb); 298 271 tcon = cifs_sb->tcon; 299 272 300 - /* search inode for this file and fill in file->private_data */ 301 273 pCifsInode = CIFS_I(file->f_path.dentry->d_inode); 302 - read_lock(&GlobalSMBSeslock); 303 - list_for_each(tmp, &pCifsInode->openFileList) { 304 - pCifsFile = list_entry(tmp, struct cifsFileInfo, 305 - flist); 306 - if ((pCifsFile->pfile == NULL) && 307 - (pCifsFile->pid == current->tgid)) { 308 - /* mode set in cifs_create */ 309 - 310 - /* needed for writepage */ 311 - pCifsFile->pfile = file; 312 - 313 - file->private_data = pCifsFile; 314 - break; 315 - } 316 - } 317 - read_unlock(&GlobalSMBSeslock); 318 - 319 - if (file->private_data != NULL) { 320 - rc = 0; 274 + pCifsFile = cifs_fill_filedata(file); 275 + if (pCifsFile) { 321 276 FreeXid(xid); 322 - return rc; 323 - } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 324 - cERROR(1, ("could not find file instance for " 325 - "new file %p", file)); 277 + return 0; 278 + } 326 279 327 280 full_path = build_path_from_dentry(file->f_path.dentry); 328 281 if (full_path == NULL) { ··· 332 325 /* no need for special case handling of setting mode 333 326 on read only files needed here */ 334 327 328 + pCifsFile = cifs_fill_filedata(file); 335 329 cifs_posix_open_inode_helper(inode, file, pCifsInode, 336 330 pCifsFile, oplock, netfid); 337 331 goto out;