Commit 82940a46 authored by Steve French's avatar Steve French

[CIFS] Make POSIX CIFS Extensions SetFSInfo match exactly what we want

not just the posix path feature.
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 46c79a64
......@@ -422,6 +422,13 @@ A partial list of the supported mount options follows:
nomapchars Do not translate any of these seven characters (default).
nocase Request case insensitive path name matching (case
sensitive is the default if the server suports it).
posixpaths If CIFS Unix extensions are supported, attempt to
negotiate posix path name support which allows certain
characters forbidden in typical CIFS filenames, without
requiring remapping. (default)
noposixpaths If CIFS Unix extensions are supported, do not request
posix path name support (this may cause servers to
reject creatingfile with certain reserved characters).
nobrl Do not send byte range lock requests to the server.
This is necessary for certain applications that break
with cifs style mandatory byte range locks (and most
......
......@@ -1789,7 +1789,13 @@ typedef struct {
#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */
#define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */
#define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */
#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Use POSIX pathnames on the wire. */
#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */
#ifdef CONFIG_CIFS_POSIX
#define CIFS_UNIX_CAP_MASK 0x0000001b
#else
#define CIFS_UNIX_CAP_MASK 0x00000013
#endif /* CONFIG_CIFS_POSIX */
#define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */
......
......@@ -1920,27 +1920,34 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->tcon = tcon;
tcon->ses = pSesInfo;
/* do not care if following two calls succeed - informational only */
/* do not care if following two calls succeed - informational */
CIFSSMBQFSDeviceInfo(xid, tcon);
CIFSSMBQFSAttributeInfo(xid, tcon);
if (tcon->ses->capabilities & CAP_UNIX) {
if(!CIFSSMBQFSUnixInfo(xid, tcon)) {
if(!volume_info.no_psx_acl) {
if(CIFS_UNIX_POSIX_ACL_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))
cFYI(1,("server negotiated posix acl support"));
sb->s_flags |= MS_POSIXACL;
__u64 cap =
le64_to_cpu(tcon->fsUnixInfo.Capability);
cap &= CIFS_UNIX_CAP_MASK;
if(volume_info.no_psx_acl)
cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
else if(CIFS_UNIX_POSIX_ACL_CAP & cap) {
cFYI(1,("negotiated posix acl support"));
sb->s_flags |= MS_POSIXACL;
}
/* Try and negotiate POSIX pathnames if we can. */
if (volume_info.posix_paths && (CIFS_UNIX_POSIX_PATHNAMES_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) {
if (!CIFSSMBSetFSUnixInfo(xid, tcon, CIFS_UNIX_POSIX_PATHNAMES_CAP)) {
cFYI(1,("negotiated posix pathnames support"));
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
} else {
cFYI(1,("posix pathnames support requested but not supported"));
}
if(volume_info.posix_paths == 0)
cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
else if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
cFYI(1,("negotiate posix pathnames"));
cifs_sb->mnt_cifs_flags |=
CIFS_MOUNT_POSIX_PATHS;
}
cFYI(1,("Negotiate caps 0x%x",(int)cap));
if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
cFYI(1,("setting capabilities failed"));
}
}
}
......
......@@ -649,7 +649,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
wire */
if (IS_GETLK(cmd)) {
if(experimEnabled &&
(cifs_sb->tcon->ses->capabilities & CAP_UNIX)) {
(cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
(CIFS_UNIX_FCNTL_CAP &
le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) {
int posix_lock_type;
if(lockType & LOCKING_ANDX_SHARED_LOCK)
posix_lock_type = CIFS_RDLCK;
......@@ -686,7 +688,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
return rc;
}
if (experimEnabled &&
(cifs_sb->tcon->ses->capabilities & CAP_UNIX)) {
(cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
(CIFS_UNIX_FCNTL_CAP &
le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) {
int posix_lock_type;
if(lockType & LOCKING_ANDX_SHARED_LOCK)
posix_lock_type = CIFS_RDLCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment