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] Avoid open on possible directories since Samba now rejects them

+24 -19
+24 -19
fs/cifs/dir.c
··· 657 657 } 658 658 cFYI(1, ("Full path: %s inode = 0x%p", full_path, direntry->d_inode)); 659 659 660 + /* Posix open is only called (at lookup time) for file create now. 661 + * For opens (rather than creates), because we do not know if it 662 + * is a file or directory yet, and current Samba no longer allows 663 + * us to do posix open on dirs, we could end up wasting an open call 664 + * on what turns out to be a dir. For file opens, we wait to call posix 665 + * open till cifs_open. It could be added here (lookup) in the future 666 + * but the performance tradeoff of the extra network request when EISDIR 667 + * or EACCES is returned would have to be weighed against the 50% 668 + * reduction in network traffic in the other paths. 669 + */ 660 670 if (pTcon->unix_ext) { 661 671 if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && 662 - (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) { 663 - if (!((nd->intent.open.flags & O_CREAT) && 664 - (nd->intent.open.flags & O_EXCL))) { 665 - rc = cifs_posix_open(full_path, &newInode, 672 + (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && 673 + (nd->intent.open.flags & O_CREAT)) { 674 + rc = cifs_posix_open(full_path, &newInode, 666 675 parent_dir_inode->i_sb, 667 676 nd->intent.open.create_mode, 668 677 nd->intent.open.flags, &oplock, 669 678 &fileHandle, xid); 670 - /* 671 - * This code works around a bug in 672 - * samba posix open in samba versions 3.3.1 673 - * and earlier where create works 674 - * but open fails with invalid parameter. 675 - * If either of these error codes are 676 - * returned, follow the normal lookup. 677 - * Otherwise, the error during posix open 678 - * is handled. 679 - */ 680 - if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) 681 - posix_open = true; 682 - else 683 - pTcon->broken_posix_open = true; 684 - } 679 + /* 680 + * The check below works around a bug in POSIX 681 + * open in samba versions 3.3.1 and earlier where 682 + * open could incorrectly fail with invalid parameter. 683 + * If either that or op not supported returned, follow 684 + * the normal lookup. 685 + */ 686 + if ((rc == 0) || (rc == -ENOENT)) 687 + posix_open = true; 688 + else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP)) 689 + pTcon->broken_posix_open = true; 685 690 } 686 691 if (!posix_open) 687 692 rc = cifs_get_inode_info_unix(&newInode, full_path,