summaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2009-03-04 19:54:08 +0000
committerSteve French <sfrench@us.ibm.com>2009-03-12 01:36:21 +0000
commit64cc2c63694a03393985ffc8b178e72f52dd8a06 (patch)
tree819161cd3f6b4268b5ff21dfb0c427496134fef5 /fs/cifs/file.c
parent276a74a4835ad86d6da42f3a084b060afc5656e8 (diff)
[CIFS] work around bug in Samba server handling for posix open
Samba server (version 3.3.1 and earlier, and 3.2.8 and earlier) incorrectly required the O_CREAT flag on posix open (even when a file was not being created). This disables posix open (create is still ok) after the first attempt returns EINVAL (and logs an error, once, recommending that they update their server). Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7bef4cce572..81747acca4c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -328,7 +328,8 @@ int cifs_open(struct inode *inode, struct file *file)
else
oplock = 0;
- if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
+ if (!tcon->broken_posix_open && tcon->unix_ext &&
+ (tcon->ses->capabilities & CAP_UNIX) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) {
int oflags = (int) cifs_posix_convert_flags(file->f_flags);
@@ -344,11 +345,20 @@ int cifs_open(struct inode *inode, struct file *file)
cifs_posix_open_inode_helper(inode, file, pCifsInode,
pCifsFile, oplock, netfid);
goto out;
+ } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
+ if (tcon->ses->serverNOS)
+ cERROR(1, ("server %s of type %s returned"
+ " unexpected error on SMB posix open"
+ ", disabling posix open support."
+ " Check if server update available.",
+ tcon->ses->serverName,
+ tcon->ses->serverNOS));
+ tcon->broken_posix_open = true;
} else if ((rc != -EIO) && (rc != -EREMOTE) &&
(rc != -EOPNOTSUPP)) /* path not found or net err */
goto out;
- /* fallthrough to retry open the old way on operation
- not supported or DFS errors */
+ /* else fallthrough to retry open the old way on network i/o
+ or DFS errors */
}
desiredAccess = cifs_convert_flags(file->f_flags);