[CIFS] Add mount option for disabling sending byte range lock requests

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)
This commit is contained in:
Steve French 2005-08-18 20:49:57 -07:00
parent 8d0d50948b
commit c46fa8acdc
7 changed files with 39 additions and 8 deletions

View 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 Version 1.35
------------ ------------
Add writepage performance improvements. Fix path name conversions Add writepage performance improvements. Fix path name conversions

View File

@ -407,6 +407,13 @@ A partial list of the supported mount options follows:
This has no effect if the server does not support This has no effect if the server does not support
Unicode on the wire. Unicode on the wire.
nomapchars Do not translate any of these seven characters (default). 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 remount remount the share (often used to change from ro to rw mounts
or vice versa) or vice versa)

View File

@ -26,6 +26,8 @@
#define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */ #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_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible. */
#define CIFS_MOUNT_UNX_EMUL 0x80 /* Network compat with SFUnix emulation */ #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 cifs_sb_info {
struct cifsTconInfo *tcon; /* primary mount */ struct cifsTconInfo *tcon; /* primary mount */

View 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 ssize_t cifs_listxattr(struct dentry *, char *, size_t);
extern int cifs_ioctl (struct inode * inode, struct file * filep, extern int cifs_ioctl (struct inode * inode, struct file * filep,
unsigned int command, unsigned long arg); unsigned int command, unsigned long arg);
#define CIFS_VERSION "1.35" #define CIFS_VERSION "1.36"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */

View File

@ -79,6 +79,8 @@ struct smb_vol {
unsigned remap:1; /* set to remap seven reserved chars in filenames */ unsigned remap:1; /* set to remap seven reserved chars in filenames */
unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ unsigned posix_paths:1; /* unset to not ask for posix pathnames. */
unsigned sfu_emul:1; unsigned sfu_emul:1;
unsigned nocase; /* request case insensitive filenames */
unsigned nobrl; /* disable sending byte range locks to srv */
unsigned int rsize; unsigned int rsize;
unsigned int wsize; unsigned int wsize;
unsigned int sockopt; unsigned int sockopt;
@ -1040,6 +1042,12 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
vol->posix_paths = 1; vol->posix_paths = 1;
} else if (strnicmp(data, "noposixpaths", 12) == 0) { } else if (strnicmp(data, "noposixpaths", 12) == 0) {
vol->posix_paths = 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) { } else if (strnicmp(data, "setuids", 7) == 0) {
vol->setuids = 1; vol->setuids = 1;
} else if (strnicmp(data, "nosetuids", 9) == 0) { } 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; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR;
if(volume_info.sfu_emul) if(volume_info.sfu_emul)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_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) { 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; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
} }

View File

@ -166,6 +166,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
inode->i_fop = &cifs_file_direct_ops; inode->i_fop = &cifs_file_direct_ops;
else else
inode->i_fop = &cifs_file_ops; 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; inode->i_data.a_ops = &cifs_addr_ops;
} else if (S_ISDIR(inode->i_mode)) { } else if (S_ISDIR(inode->i_mode)) {
cFYI(1, (" Directory inode")); cFYI(1, (" Directory inode"));
@ -369,6 +371,8 @@ int cifs_get_inode_info(struct inode **pinode,
inode->i_fop = &cifs_file_direct_ops; inode->i_fop = &cifs_file_direct_ops;
else else
inode->i_fop = &cifs_file_ops; 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; inode->i_data.a_ops = &cifs_addr_ops;
} else if (S_ISDIR(inode->i_mode)) { } else if (S_ISDIR(inode->i_mode)) {
cFYI(1, (" Directory inode ")); cFYI(1, (" Directory inode "));

View File

@ -194,6 +194,8 @@ static void fill_in_inode(struct inode *tmp_inode,
tmp_inode->i_fop = &cifs_file_direct_ops; tmp_inode->i_fop = &cifs_file_direct_ops;
else else
tmp_inode->i_fop = &cifs_file_ops; 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; tmp_inode->i_data.a_ops = &cifs_addr_ops;
if(isNewInode) if(isNewInode)
@ -298,6 +300,8 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
tmp_inode->i_fop = &cifs_file_direct_ops; tmp_inode->i_fop = &cifs_file_direct_ops;
else else
tmp_inode->i_fop = &cifs_file_ops; 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; tmp_inode->i_data.a_ops = &cifs_addr_ops;
if(isNewInode) 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 + char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start +
smbCalcSize((struct smb_hdr *) smbCalcSize((struct smb_hdr *)
cifsFile->srch_inf.ntwrk_buf_start); 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 first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry
- cifsFile->srch_inf.entries_in_buffer; - cifsFile->srch_inf.entries_in_buffer;
pos_in_buf = index_to_find - first_entry_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; *num_to_ret = 0;
} else } else
*num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf; *num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf;
/* dump_cifs_file_struct(file, "end fce ");*/
return rc; return rc;
} }
@ -815,14 +817,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
FreeXid(xid); FreeXid(xid);
return -EIO; return -EIO;
} }
/* dump_cifs_file_struct(file, "Begin rdir "); */
cifs_sb = CIFS_SB(file->f_dentry->d_sb); cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
if(pTcon == NULL) if(pTcon == NULL)
return -EINVAL; return -EINVAL;
/* cFYI(1,("readdir2 pos: %lld",file->f_pos)); */
switch ((int) file->f_pos) { switch ((int) file->f_pos) {
case 0: case 0:
@ -876,7 +876,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile->search_resume_name = NULL; */ cifsFile->search_resume_name = NULL; */
/* BB account for . and .. in f_pos as special case */ /* 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, rc = find_cifs_entry(xid,pTcon, file,
&current_entry,&num_to_fill); &current_entry,&num_to_fill);
@ -924,7 +923,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
} /* end switch */ } /* end switch */
rddir2_exit: rddir2_exit:
/* dump_cifs_file_struct(file, "end rdir "); */
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }