Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b94bcb9 authored by Steve French's avatar Steve French
Browse files

[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: default avatarSteve French <sfrench@us.ibm.com>
parent 1b397f4f
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -631,6 +631,46 @@ struct file_operations cifs_file_direct_ops = {
	.ioctl  = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */

#ifdef CONFIG_CIFS_EXPERIMENTAL
	.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 */
+2 −0
Original line number Diff line number Diff line
@@ -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);
+25 −15
Original line number Diff line number Diff line
@@ -162,12 +162,17 @@ int cifs_get_inode_info_unix(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;
			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 < 
@@ -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;
			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)
+8 −2
Original line number Diff line number Diff line
@@ -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)
		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)