aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-11 14:41:00 -0500
committerSteve French <sfrench@us.ibm.com>2005-11-11 14:41:00 -0500
commit8b94bcb923dff923a5a5b7c6f890702a54cb19cf (patch)
tree2ea55c01e0c5dfead8699484b0bae2a375b1f61c /fs
parent1b397f4f1c167dbf06397b3182fca521c00125c4 (diff)
[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: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.c40
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/inode.c40
-rw-r--r--fs/cifs/readdir.c10
4 files changed, 75 insertions, 17 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 682b0235ad9a..1433455c61ea 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -635,6 +635,46 @@ struct file_operations cifs_file_direct_ops = {
635 .dir_notify = cifs_dir_notify, 635 .dir_notify = cifs_dir_notify,
636#endif /* CONFIG_CIFS_EXPERIMENTAL */ 636#endif /* CONFIG_CIFS_EXPERIMENTAL */
637}; 637};
638struct file_operations cifs_file_nobrl_ops = {
639 .read = cifs_read_wrapper,
640 .write = cifs_write_wrapper,
641 .open = cifs_open,
642 .release = cifs_close,
643 .fsync = cifs_fsync,
644 .flush = cifs_flush,
645 .mmap = cifs_file_mmap,
646 .sendfile = generic_file_sendfile,
647#ifdef CONFIG_CIFS_POSIX
648 .ioctl = cifs_ioctl,
649#endif /* CONFIG_CIFS_POSIX */
650
651#ifdef CONFIG_CIFS_EXPERIMENTAL
652 .readv = generic_file_readv,
653 .writev = generic_file_writev,
654 .aio_read = generic_file_aio_read,
655 .aio_write = generic_file_aio_write,
656 .dir_notify = cifs_dir_notify,
657#endif /* CONFIG_CIFS_EXPERIMENTAL */
658};
659
660struct file_operations cifs_file_direct_nobrl_ops = {
661 /* no mmap, no aio, no readv -
662 BB reevaluate whether they can be done with directio, no cache */
663 .read = cifs_user_read,
664 .write = cifs_user_write,
665 .open = cifs_open,
666 .release = cifs_close,
667 .fsync = cifs_fsync,
668 .flush = cifs_flush,
669 .sendfile = generic_file_sendfile, /* BB removeme BB */
670#ifdef CONFIG_CIFS_POSIX
671 .ioctl = cifs_ioctl,
672#endif /* CONFIG_CIFS_POSIX */
673
674#ifdef CONFIG_CIFS_EXPERIMENTAL
675 .dir_notify = cifs_dir_notify,
676#endif /* CONFIG_CIFS_EXPERIMENTAL */
677};
638 678
639struct file_operations cifs_dir_ops = { 679struct file_operations cifs_dir_ops = {
640 .readdir = cifs_readdir, 680 .readdir = cifs_readdir,
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 1223fa81dbd2..9ec40e0e54fc 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops;
63/* Functions related to files and directories */ 63/* Functions related to files and directories */
64extern struct file_operations cifs_file_ops; 64extern struct file_operations cifs_file_ops;
65extern struct file_operations cifs_file_direct_ops; /* if directio mount */ 65extern struct file_operations cifs_file_direct_ops; /* if directio mount */
66extern struct file_operations cifs_file_nobrl_ops;
67extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
66extern int cifs_open(struct inode *inode, struct file *file); 68extern int cifs_open(struct inode *inode, struct file *file);
67extern int cifs_close(struct inode *inode, struct file *file); 69extern int cifs_close(struct inode *inode, struct file *file);
68extern int cifs_closedir(struct inode *inode, struct file *file); 70extern int cifs_closedir(struct inode *inode, struct file *file);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 923d071163b2..941b247fceb0 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -155,34 +155,39 @@ int cifs_get_inode_info_unix(struct inode **pinode,
155 } 155 }
156 156
157 if (num_of_bytes < end_of_file) 157 if (num_of_bytes < end_of_file)
158 cFYI(1, ("allocation size less than end of file ")); 158 cFYI(1, ("allocation size less than end of file"));
159 cFYI(1, 159 cFYI(1,
160 ("Size %ld and blocks %ld", 160 ("Size %ld and blocks %ld",
161 (unsigned long) inode->i_size, inode->i_blocks)); 161 (unsigned long) inode->i_size, inode->i_blocks));
162 if (S_ISREG(inode->i_mode)) { 162 if (S_ISREG(inode->i_mode)) {
163 cFYI(1, (" File inode ")); 163 cFYI(1, ("File inode"));
164 inode->i_op = &cifs_file_inode_ops; 164 inode->i_op = &cifs_file_inode_ops;
165 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 165 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
166 inode->i_fop = &cifs_file_direct_ops; 166 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
167 else 167 inode->i_fop =
168 &cifs_file_direct_nobrl_ops;
169 else
170 inode->i_fop = &cifs_file_direct_ops;
171 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
172 inode->i_fop = &cifs_file_nobrl_ops;
173 else /* not direct, send byte range locks */
168 inode->i_fop = &cifs_file_ops; 174 inode->i_fop = &cifs_file_ops;
169 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 175
170 inode->i_fop->lock = NULL;
171 inode->i_data.a_ops = &cifs_addr_ops; 176 inode->i_data.a_ops = &cifs_addr_ops;
172 /* check if server can support readpages */ 177 /* check if server can support readpages */
173 if(pTcon->ses->server->maxBuf < 178 if(pTcon->ses->server->maxBuf <
174 4096 + MAX_CIFS_HDR_SIZE) 179 4096 + MAX_CIFS_HDR_SIZE)
175 inode->i_data.a_ops->readpages = NULL; 180 inode->i_data.a_ops->readpages = NULL;
176 } else if (S_ISDIR(inode->i_mode)) { 181 } else if (S_ISDIR(inode->i_mode)) {
177 cFYI(1, (" Directory inode")); 182 cFYI(1, ("Directory inode"));
178 inode->i_op = &cifs_dir_inode_ops; 183 inode->i_op = &cifs_dir_inode_ops;
179 inode->i_fop = &cifs_dir_ops; 184 inode->i_fop = &cifs_dir_ops;
180 } else if (S_ISLNK(inode->i_mode)) { 185 } else if (S_ISLNK(inode->i_mode)) {
181 cFYI(1, (" Symbolic Link inode ")); 186 cFYI(1, ("Symbolic Link inode"));
182 inode->i_op = &cifs_symlink_inode_ops; 187 inode->i_op = &cifs_symlink_inode_ops;
183 /* tmp_inode->i_fop = */ /* do not need to set to anything */ 188 /* tmp_inode->i_fop = */ /* do not need to set to anything */
184 } else { 189 } else {
185 cFYI(1, (" Init special inode ")); 190 cFYI(1, ("Init special inode"));
186 init_special_inode(inode, inode->i_mode, 191 init_special_inode(inode, inode->i_mode,
187 inode->i_rdev); 192 inode->i_rdev);
188 } 193 }
@@ -379,12 +384,17 @@ int cifs_get_inode_info(struct inode **pinode,
379 if (S_ISREG(inode->i_mode)) { 384 if (S_ISREG(inode->i_mode)) {
380 cFYI(1, (" File inode ")); 385 cFYI(1, (" File inode "));
381 inode->i_op = &cifs_file_inode_ops; 386 inode->i_op = &cifs_file_inode_ops;
382 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 387 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
383 inode->i_fop = &cifs_file_direct_ops; 388 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
384 else 389 inode->i_fop =
390 &cifs_file_direct_nobrl_ops;
391 else
392 inode->i_fop = &cifs_file_direct_ops;
393 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
394 inode->i_fop = &cifs_file_nobrl_ops;
395 else /* not direct, send byte range locks */
385 inode->i_fop = &cifs_file_ops; 396 inode->i_fop = &cifs_file_ops;
386 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 397
387 inode->i_fop->lock = NULL;
388 inode->i_data.a_ops = &cifs_addr_ops; 398 inode->i_data.a_ops = &cifs_addr_ops;
389 if(pTcon->ses->server->maxBuf < 399 if(pTcon->ses->server->maxBuf <
390 4096 + MAX_CIFS_HDR_SIZE) 400 4096 + MAX_CIFS_HDR_SIZE)
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index a86bd1c07602..fc615670f4b8 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -193,8 +193,14 @@ static void fill_in_inode(struct inode *tmp_inode,
193 if (S_ISREG(tmp_inode->i_mode)) { 193 if (S_ISREG(tmp_inode->i_mode)) {
194 cFYI(1, ("File inode")); 194 cFYI(1, ("File inode"));
195 tmp_inode->i_op = &cifs_file_inode_ops; 195 tmp_inode->i_op = &cifs_file_inode_ops;
196 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) 196 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
197 tmp_inode->i_fop = &cifs_file_direct_ops; 197 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
198 tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
199 else
200 tmp_inode->i_fop = &cifs_file_direct_ops;
201
202 } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
203 tmp_inode->i_fop = &cifs_file_nobrl_ops;
198 else 204 else
199 tmp_inode->i_fop = &cifs_file_ops; 205 tmp_inode->i_fop = &cifs_file_ops;
200 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 206 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)