]> err.no Git - linux-2.6/commitdiff
[CIFS] Fix CIFS "nobrl" mount option so does not disable sending brl requests
authorSteve French <sfrench@us.ibm.com>
Fri, 11 Nov 2005 19:41:00 +0000 (11:41 -0800)
committerSteve French <sfrench@us.ibm.com>
Fri, 11 Nov 2005 19:41:00 +0000 (11:41 -0800)
for all mounts just that particular mount.

Found by Arjan Vand de Ven

Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifsfs.c
fs/cifs/cifsfs.h
fs/cifs/inode.c
fs/cifs/readdir.c

index 682b0235ad9a170df904563eea37d9a132291ce2..1433455c61eafa9d651862dca8b0747a282ecf62 100644 (file)
@@ -635,6 +635,46 @@ struct file_operations cifs_file_direct_ops = {
        .dir_notify = cifs_dir_notify,
 #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 = {
        .readdir = cifs_readdir,
index 1223fa81dbd269fc696e90951787e29426273f64..9ec40e0e54fc4eed289eb9070aeb0c8120f610cd 100644 (file)
@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops;
 /* Functions related to files and directories */
 extern struct file_operations cifs_file_ops;
 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_close(struct inode *inode, struct file *file);
 extern int cifs_closedir(struct inode *inode, struct file *file);
index 923d071163b2769f86e4a5b47d2e77878d13a072..941b247fceb024d1beb8386cb8585bab0074f25b 100644 (file)
@@ -155,34 +155,39 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                }
 
                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,
                     ("Size %ld and blocks %ld",
                      (unsigned long) inode->i_size, inode->i_blocks));
                if (S_ISREG(inode->i_mode)) {
-                       cFYI(1, (" File inode "));
+                       cFYI(1, ("File inode"));
                        inode->i_op = &cifs_file_inode_ops;
-                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
-                               inode->i_fop = &cifs_file_direct_ops;
-                       else
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
+                               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                                       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;
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-                               inode->i_fop->lock = NULL;
+
                        inode->i_data.a_ops = &cifs_addr_ops;
                        /* check if server can support readpages */
                        if(pTcon->ses->server->maxBuf < 
                            4096 + MAX_CIFS_HDR_SIZE)
                                inode->i_data.a_ops->readpages = NULL;
                } else if (S_ISDIR(inode->i_mode)) {
-                       cFYI(1, (" Directory inode"));
+                       cFYI(1, ("Directory inode"));
                        inode->i_op = &cifs_dir_inode_ops;
                        inode->i_fop = &cifs_dir_ops;
                } else if (S_ISLNK(inode->i_mode)) {
-                       cFYI(1, (" Symbolic Link inode "));
+                       cFYI(1, ("Symbolic Link inode"));
                        inode->i_op = &cifs_symlink_inode_ops;
                /* tmp_inode->i_fop = */ /* do not need to set to anything */
                } else {
-                       cFYI(1, (" Init special inode "));
+                       cFYI(1, ("Init special inode"));
                        init_special_inode(inode, inode->i_mode,
                                           inode->i_rdev);
                }
@@ -379,12 +384,17 @@ int cifs_get_inode_info(struct inode **pinode,
                if (S_ISREG(inode->i_mode)) {
                        cFYI(1, (" File inode "));
                        inode->i_op = &cifs_file_inode_ops;
-                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
-                               inode->i_fop = &cifs_file_direct_ops;
-                       else
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
+                               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                                       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;
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-                               inode->i_fop->lock = NULL;
+
                        inode->i_data.a_ops = &cifs_addr_ops;
                        if(pTcon->ses->server->maxBuf < 
                             4096 + MAX_CIFS_HDR_SIZE)
index a86bd1c076021bb88bec0da95a4d939b0785d69d..fc615670f4b8b7f73efc52b318c2f425155f272d 100644 (file)
@@ -193,8 +193,14 @@ static void fill_in_inode(struct inode *tmp_inode,
        if (S_ISREG(tmp_inode->i_mode)) {
                cFYI(1, ("File inode"));
                tmp_inode->i_op = &cifs_file_inode_ops;
-               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_DIRECT_IO) {
+                       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
                        tmp_inode->i_fop = &cifs_file_ops;
                if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)