diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index f49d684..c306d3f 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -660,8 +660,16 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, if (pTcon->unix_ext) { if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) { - if (!((nd->intent.open.flags & O_CREAT) && - (nd->intent.open.flags & O_EXCL))) { + if (nd->intent.open.flags & O_CREAT) { + /* POSIX open here is only called for file + create. It does not help much for file opens + because we do not know if it is a file + or directory, and current Samba no + longer allows us to do posix open on dirs, + so we could end up wasting an open + call on what turns out to be a dir. + For file opens, we call posix open + in cifs_open */ rc = cifs_posix_open(full_path, &newInode, parent_dir_inode->i_sb, nd->intent.open.create_mode, diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index e2fe998..f465aaf 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -79,6 +79,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { {ErrQuota, -EDQUOT}, {ErrNotALink, -ENOLINK}, {ERRnetlogonNotStarted, -ENOPROTOOPT}, + {ERRisdir, -EISDIR}, {ERRsymlink, -EOPNOTSUPP}, {ErrTooManyLinks, -EMLINK}, {0, 0} @@ -368,7 +369,7 @@ static const struct { ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, { ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, { ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, { - ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, { + ERRDOS, ERRisdir, NT_STATUS_FILE_IS_A_DIRECTORY}, { ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, { ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, { ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, { diff --git a/fs/cifs/smberr.h b/fs/cifs/smberr.h index c5084d2..5481525 100644 --- a/fs/cifs/smberr.h +++ b/fs/cifs/smberr.h @@ -110,6 +110,7 @@ /* Below errors are used internally (do not come over the wire) for passthrough from STATUS codes to POSIX only */ +#define ERRisdir 0xFFFC #define ERRsymlink 0xFFFD #define ErrTooManyLinks 0xFFFE