[CIFS] Add mount option for disabling sending byte range lock requests
authorSteve French <sfrench@us.ibm.com>
Fri, 19 Aug 2005 03:49:57 +0000 (20:49 -0700)
committerSteve French <sfrench@us.ibm.com>
Fri, 19 Aug 2005 03:49:57 +0000 (20:49 -0700)
over the wire (to help the case when applications break with cifs mandatory
lock behavior.  Add part one of mount option for requesting case
insensitive path name matching.

Signed-off-by: Steve French (sfrench@us.ibm.com)
fs/cifs/CHANGES
fs/cifs/README
fs/cifs/cifs_fs_sb.h
fs/cifs/cifsfs.h
fs/cifs/connect.c
fs/cifs/inode.c
fs/cifs/readdir.c

index 3196d4c..b0429ea 100644 (file)
@@ -1,3 +1,11 @@
+Version 1.36
+------------
+Add mount option for disabling the default behavior of sending byte range lock
+requests to the server (necessary for certain applications which break with
+mandatory lock behavior such as Evolution), and also mount option for
+requesting case insensitive matching for path based requests (requesting
+case sensitive is the default).
+
 Version 1.35
 ------------
 Add writepage performance improvements.  Fix path name conversions
index 34b0cf7..3b610d0 100644 (file)
@@ -407,6 +407,13 @@ A partial list of the supported mount options follows:
                This has no effect if the server does not support
                Unicode on the wire.
  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).
+ 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
+               cifs servers do not yet support requesting advisory
+               byte range locks).
  remount        remount the share (often used to change from ro to rw mounts
                or vice versa)
                
index 6b93587..5fb695f 100644 (file)
@@ -26,6 +26,8 @@
 #define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */
 #define CIFS_MOUNT_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible. */
 #define CIFS_MOUNT_UNX_EMUL    0x80 /* Network compat with SFUnix emulation */
+#define CIFS_MOUNT_CASE_INSENS  0x100 /* Request case insenstive searches */
+#define CIFS_MOUNT_NO_BRL      0x200 /* No sending byte range locks to srv */
 
 struct cifs_sb_info {
        struct cifsTconInfo *tcon;      /* primary mount */
index 78af585..cf45ca3 100644 (file)
@@ -96,5 +96,5 @@ extern ssize_t        cifs_getxattr(struct dentry *, const char *, void *, size_t);
 extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
 extern int cifs_ioctl (struct inode * inode, struct file * filep,
                       unsigned int command, unsigned long arg);
-#define CIFS_VERSION   "1.35"
+#define CIFS_VERSION   "1.36"
 #endif                         /* _CIFSFS_H */
index ef0432c..6b21f6a 100644 (file)
@@ -79,6 +79,8 @@ struct smb_vol {
        unsigned remap:1;   /* set to remap seven reserved chars in filenames */
        unsigned posix_paths:1;   /* unset to not ask for posix pathnames. */
        unsigned sfu_emul:1;
+       unsigned nocase;     /* request case insensitive filenames */
+       unsigned nobrl;      /* disable sending byte range locks to srv */
        unsigned int rsize;
        unsigned int wsize;
        unsigned int sockopt;
@@ -1040,6 +1042,12 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
                        vol->posix_paths = 1;
                } else if (strnicmp(data, "noposixpaths", 12) == 0) {
                        vol->posix_paths = 0;
+                } else if (strnicmp(data, "nocase", 6) == 0) {
+                        vol->nocase = 1;
+               } else if (strnicmp(data, "brl", 3) == 0) {
+                       vol->nobrl =  0;
+               } else if (strnicmp(data, "nobrl", 5) == 0) {
+                       vol->nobrl =  1;
                } else if (strnicmp(data, "setuids", 7) == 0) {
                        vol->setuids = 1;
                } else if (strnicmp(data, "nosetuids", 9) == 0) {
@@ -1699,9 +1707,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR;
                if(volume_info.sfu_emul)
                        cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL;
+               if(volume_info.nocase)
+                       cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CASE_INSENS;
+               if(volume_info.nobrl)
+                       cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL;
 
                if(volume_info.direct_io) {
-                       cERROR(1,("mounting share using direct i/o"));
+                       cFYI(1,("mounting share using direct i/o"));
                        cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
                }
 
index 628aa1a..ed3e920 100644 (file)
@@ -166,6 +166,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                                inode->i_fop = &cifs_file_direct_ops;
                        else
                                inode->i_fop = &cifs_file_ops;
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                               inode->i_fop->lock = NULL;
                        inode->i_data.a_ops = &cifs_addr_ops;
                } else if (S_ISDIR(inode->i_mode)) {
                        cFYI(1, (" Directory inode"));
@@ -369,6 +371,8 @@ int cifs_get_inode_info(struct inode **pinode,
                                inode->i_fop = &cifs_file_direct_ops;
                        else
                                inode->i_fop = &cifs_file_ops;
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                               inode->i_fop->lock = NULL;
                        inode->i_data.a_ops = &cifs_addr_ops;
                } else if (S_ISDIR(inode->i_mode)) {
                        cFYI(1, (" Directory inode "));
index dec3c9d..ef5eb80 100644 (file)
@@ -194,6 +194,8 @@ static void fill_in_inode(struct inode *tmp_inode,
                        tmp_inode->i_fop = &cifs_file_direct_ops;
                else
                        tmp_inode->i_fop = &cifs_file_ops;
+               if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                       tmp_inode->i_fop->lock = NULL;
                tmp_inode->i_data.a_ops = &cifs_addr_ops;
 
                if(isNewInode)
@@ -298,6 +300,8 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
                        tmp_inode->i_fop = &cifs_file_direct_ops;
                else
                        tmp_inode->i_fop = &cifs_file_ops;
+               if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                       tmp_inode->i_fop->lock = NULL;
                tmp_inode->i_data.a_ops = &cifs_addr_ops;
 
                if(isNewInode)
@@ -557,7 +561,6 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
                char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + 
                        smbCalcSize((struct smb_hdr *)
                                cifsFile->srch_inf.ntwrk_buf_start);
-/*     dump_cifs_file_struct(file,"found entry in fce "); */
                first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry
                                        - cifsFile->srch_inf.entries_in_buffer;
                pos_in_buf = index_to_find - first_entry_in_buffer;
@@ -595,7 +598,6 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
                *num_to_ret = 0;
        } else
                *num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf;
-/*     dump_cifs_file_struct(file, "end fce ");*/
 
        return rc;
 }
@@ -815,14 +817,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
                FreeXid(xid);
                return -EIO;
        }
-/*     dump_cifs_file_struct(file, "Begin rdir "); */
 
        cifs_sb = CIFS_SB(file->f_dentry->d_sb);
        pTcon = cifs_sb->tcon;
        if(pTcon == NULL)
                return -EINVAL;
 
-/*     cFYI(1,("readdir2 pos: %lld",file->f_pos)); */
 
        switch ((int) file->f_pos) {
        case 0:
@@ -876,7 +876,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
                cifsFile->search_resume_name = NULL; */
 
                /* BB account for . and .. in f_pos as special case */
-               /* dump_cifs_file_struct(file, "rdir after default ");*/
 
                rc = find_cifs_entry(xid,pTcon, file,
                                &current_entry,&num_to_fill);
@@ -924,7 +923,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
        } /* end switch */
 
 rddir2_exit:
-       /* dump_cifs_file_struct(file, "end rdir ");  */
        FreeXid(xid);
        return rc;
 }