diff options
author | Pavel Shilovsky <piastryyy@gmail.com> | 2010-12-14 03:29:51 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-20 16:42:25 -0500 |
commit | 7a6a19b17ab9103ec708c18befd28f2a3908d4c1 (patch) | |
tree | 3b781bf11b2a25c93ce20dbd80876e7e01c730e6 /fs | |
parent | 8be7e6ba142423e6ad98fed293c96f196f685229 (diff) |
CIFS: Implement cifs_file_strict_mmap (try #2)
Invalidate inode mapping if we don't have at least Level II oplock.
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsfs.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 1 | ||||
-rw-r--r-- | fs/cifs/file.c | 15 |
3 files changed, 18 insertions, 2 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index f6093e401c5a..e24d966fb214 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -743,7 +743,7 @@ const struct file_operations cifs_file_strict_ops = { | |||
743 | .lock = cifs_lock, | 743 | .lock = cifs_lock, |
744 | .fsync = cifs_strict_fsync, | 744 | .fsync = cifs_strict_fsync, |
745 | .flush = cifs_flush, | 745 | .flush = cifs_flush, |
746 | .mmap = cifs_file_mmap, | 746 | .mmap = cifs_file_strict_mmap, |
747 | .splice_read = generic_file_splice_read, | 747 | .splice_read = generic_file_splice_read, |
748 | .llseek = cifs_llseek, | 748 | .llseek = cifs_llseek, |
749 | #ifdef CONFIG_CIFS_POSIX | 749 | #ifdef CONFIG_CIFS_POSIX |
@@ -798,7 +798,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = { | |||
798 | .release = cifs_close, | 798 | .release = cifs_close, |
799 | .fsync = cifs_strict_fsync, | 799 | .fsync = cifs_strict_fsync, |
800 | .flush = cifs_flush, | 800 | .flush = cifs_flush, |
801 | .mmap = cifs_file_mmap, | 801 | .mmap = cifs_file_strict_mmap, |
802 | .splice_read = generic_file_splice_read, | 802 | .splice_read = generic_file_splice_read, |
803 | .llseek = cifs_llseek, | 803 | .llseek = cifs_llseek, |
804 | #ifdef CONFIG_CIFS_POSIX | 804 | #ifdef CONFIG_CIFS_POSIX |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 10c4303c282d..710072e36912 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -89,6 +89,7 @@ extern int cifs_fsync(struct file *, int); | |||
89 | extern int cifs_strict_fsync(struct file *, int); | 89 | extern int cifs_strict_fsync(struct file *, int); |
90 | extern int cifs_flush(struct file *, fl_owner_t id); | 90 | extern int cifs_flush(struct file *, fl_owner_t id); |
91 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); | 91 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); |
92 | extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *); | ||
92 | extern const struct file_operations cifs_dir_ops; | 93 | extern const struct file_operations cifs_dir_ops; |
93 | extern int cifs_dir_open(struct inode *inode, struct file *file); | 94 | extern int cifs_dir_open(struct inode *inode, struct file *file); |
94 | extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir); | 95 | extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5790fab7349b..0b32377ef8b7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1769,6 +1769,21 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1769 | return total_read; | 1769 | return total_read; |
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) | ||
1773 | { | ||
1774 | int rc, xid; | ||
1775 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1776 | |||
1777 | xid = GetXid(); | ||
1778 | |||
1779 | if (!CIFS_I(inode)->clientCanCacheRead) | ||
1780 | cifs_invalidate_mapping(inode); | ||
1781 | |||
1782 | rc = generic_file_mmap(file, vma); | ||
1783 | FreeXid(xid); | ||
1784 | return rc; | ||
1785 | } | ||
1786 | |||
1772 | int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) | 1787 | int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) |
1773 | { | 1788 | { |
1774 | int rc, xid; | 1789 | int rc, xid; |