]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[CIFS] Make POSIX CIFS Extensions SetFSInfo match exactly what we want
authorSteve French <sfrench@us.ibm.com>
Thu, 2 Mar 2006 03:24:57 +0000 (03:24 +0000)
committerSteve French <sfrench@us.ibm.com>
Thu, 2 Mar 2006 03:24:57 +0000 (03:24 +0000)
not just the posix path feature.

Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/README
fs/cifs/cifspdu.h
fs/cifs/connect.c
fs/cifs/file.c

index b0070d1b149d6d240e2457bd59455b945faa7005..b2b4d0803761b82ed937d795bdecf539ac35a9b4 100644 (file)
@@ -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
index b75866115c213eec0b35f6756a9491edf41b1991..b2233ac05bd2791f143a036fc95f313bb96bc13e 100644 (file)
@@ -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 */
 
index cf4bcf3a45e68e3d781576efe7fcfdf6822a5ccf..b8f1baabd3438d3532604df8dde78a1c2413c242 100644 (file)
@@ -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"));
                                }
                        }
                }
index bd135c4e4958855d3f1ee967c1bd601f4a8471f4..71a30fd76aa8c17fbf47ef928f3c355a41c260c5 100644 (file)
@@ -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;