提交 8b94bcb9 编写于 作者: S Steve French

[CIFS] Fix CIFS "nobrl" mount option so does not disable sending brl requests

for all mounts just that particular mount.

Found by Arjan Vand de Ven
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 1b397f4f
...@@ -635,6 +635,46 @@ struct file_operations cifs_file_direct_ops = { ...@@ -635,6 +635,46 @@ struct file_operations cifs_file_direct_ops = {
.dir_notify = cifs_dir_notify, .dir_notify = cifs_dir_notify,
#endif /* CONFIG_CIFS_EXPERIMENTAL */ #endif /* CONFIG_CIFS_EXPERIMENTAL */
}; };
struct file_operations cifs_file_nobrl_ops = {
.read = cifs_read_wrapper,
.write = cifs_write_wrapper,
.open = cifs_open,
.release = cifs_close,
.fsync = cifs_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.sendfile = generic_file_sendfile,
#ifdef CONFIG_CIFS_POSIX
.ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */
#ifdef CONFIG_CIFS_EXPERIMENTAL
.readv = generic_file_readv,
.writev = generic_file_writev,
.aio_read = generic_file_aio_read,
.aio_write = generic_file_aio_write,
.dir_notify = cifs_dir_notify,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};
struct file_operations cifs_file_direct_nobrl_ops = {
/* no mmap, no aio, no readv -
BB reevaluate whether they can be done with directio, no cache */
.read = cifs_user_read,
.write = cifs_user_write,
.open = cifs_open,
.release = cifs_close,
.fsync = cifs_fsync,
.flush = cifs_flush,
.sendfile = generic_file_sendfile, /* BB removeme BB */
#ifdef CONFIG_CIFS_POSIX
.ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */
#ifdef CONFIG_CIFS_EXPERIMENTAL
.dir_notify = cifs_dir_notify,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
};
struct file_operations cifs_dir_ops = { struct file_operations cifs_dir_ops = {
.readdir = cifs_readdir, .readdir = cifs_readdir,
......
...@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops; ...@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops;
/* Functions related to files and directories */ /* Functions related to files and directories */
extern struct file_operations cifs_file_ops; extern struct file_operations cifs_file_ops;
extern struct file_operations cifs_file_direct_ops; /* if directio mount */ extern struct file_operations cifs_file_direct_ops; /* if directio mount */
extern struct file_operations cifs_file_nobrl_ops;
extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
extern int cifs_open(struct inode *inode, struct file *file); extern int cifs_open(struct inode *inode, struct file *file);
extern int cifs_close(struct inode *inode, struct file *file); extern int cifs_close(struct inode *inode, struct file *file);
extern int cifs_closedir(struct inode *inode, struct file *file); extern int cifs_closedir(struct inode *inode, struct file *file);
......
...@@ -155,34 +155,39 @@ int cifs_get_inode_info_unix(struct inode **pinode, ...@@ -155,34 +155,39 @@ int cifs_get_inode_info_unix(struct inode **pinode,
} }
if (num_of_bytes < end_of_file) if (num_of_bytes < end_of_file)
cFYI(1, ("allocation size less than end of file ")); cFYI(1, ("allocation size less than end of file"));
cFYI(1, cFYI(1,
("Size %ld and blocks %ld", ("Size %ld and blocks %ld",
(unsigned long) inode->i_size, inode->i_blocks)); (unsigned long) inode->i_size, inode->i_blocks));
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
cFYI(1, (" File inode ")); cFYI(1, ("File inode"));
inode->i_op = &cifs_file_inode_ops; inode->i_op = &cifs_file_inode_ops;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
inode->i_fop = &cifs_file_direct_ops; if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
else inode->i_fop =
&cifs_file_direct_nobrl_ops;
else
inode->i_fop = &cifs_file_direct_ops;
} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
inode->i_fop = &cifs_file_nobrl_ops;
else /* not direct, send byte range locks */
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;
/* check if server can support readpages */ /* check if server can support readpages */
if(pTcon->ses->server->maxBuf < if(pTcon->ses->server->maxBuf <
4096 + MAX_CIFS_HDR_SIZE) 4096 + MAX_CIFS_HDR_SIZE)
inode->i_data.a_ops->readpages = NULL; inode->i_data.a_ops->readpages = NULL;
} else if (S_ISDIR(inode->i_mode)) { } else if (S_ISDIR(inode->i_mode)) {
cFYI(1, (" Directory inode")); cFYI(1, ("Directory inode"));
inode->i_op = &cifs_dir_inode_ops; inode->i_op = &cifs_dir_inode_ops;
inode->i_fop = &cifs_dir_ops; inode->i_fop = &cifs_dir_ops;
} else if (S_ISLNK(inode->i_mode)) { } else if (S_ISLNK(inode->i_mode)) {
cFYI(1, (" Symbolic Link inode ")); cFYI(1, ("Symbolic Link inode"));
inode->i_op = &cifs_symlink_inode_ops; inode->i_op = &cifs_symlink_inode_ops;
/* tmp_inode->i_fop = */ /* do not need to set to anything */ /* tmp_inode->i_fop = */ /* do not need to set to anything */
} else { } else {
cFYI(1, (" Init special inode ")); cFYI(1, ("Init special inode"));
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode,
inode->i_rdev); inode->i_rdev);
} }
...@@ -379,12 +384,17 @@ int cifs_get_inode_info(struct inode **pinode, ...@@ -379,12 +384,17 @@ int cifs_get_inode_info(struct inode **pinode,
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
cFYI(1, (" File inode ")); cFYI(1, (" File inode "));
inode->i_op = &cifs_file_inode_ops; inode->i_op = &cifs_file_inode_ops;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
inode->i_fop = &cifs_file_direct_ops; if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
else inode->i_fop =
&cifs_file_direct_nobrl_ops;
else
inode->i_fop = &cifs_file_direct_ops;
} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
inode->i_fop = &cifs_file_nobrl_ops;
else /* not direct, send byte range locks */
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;
if(pTcon->ses->server->maxBuf < if(pTcon->ses->server->maxBuf <
4096 + MAX_CIFS_HDR_SIZE) 4096 + MAX_CIFS_HDR_SIZE)
......
...@@ -193,8 +193,14 @@ static void fill_in_inode(struct inode *tmp_inode, ...@@ -193,8 +193,14 @@ static void fill_in_inode(struct inode *tmp_inode,
if (S_ISREG(tmp_inode->i_mode)) { if (S_ISREG(tmp_inode->i_mode)) {
cFYI(1, ("File inode")); cFYI(1, ("File inode"));
tmp_inode->i_op = &cifs_file_inode_ops; tmp_inode->i_op = &cifs_file_inode_ops;
if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
tmp_inode->i_fop = &cifs_file_direct_ops; if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
else
tmp_inode->i_fop = &cifs_file_direct_ops;
} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
tmp_inode->i_fop = &cifs_file_nobrl_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) if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册