Commit b10099792b6276c31cee4c021e0a5d3f9a9e33ed
Committed by
Linus Torvalds
1 parent
e00d2c2d4a
fuse: fix page invalidation
Other than truncate, there are two cases, when fuse tries to get rid of cached pages: a) in open, if KEEP_CACHE flag is not set b) in getattr, if file size changed spontaneously Until now invalidate_mapping_pages() were used, which didn't get rid of mapped pages. This is wrong, and becomes more wrong as dirty pages are introduced. So instead properly invalidate all pages with invalidate_inode_pages2(). Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff
fs/fuse/file.c
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | if (outarg->open_flags & FOPEN_DIRECT_IO) |
88 | 88 | file->f_op = &fuse_direct_io_file_operations; |
89 | 89 | if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) |
90 | - invalidate_mapping_pages(inode->i_mapping, 0, -1); | |
90 | + invalidate_inode_pages2(inode->i_mapping); | |
91 | 91 | ff->fh = outarg->fh; |
92 | 92 | file->private_data = fuse_file_get(ff); |
93 | 93 | } |
fs/fuse/inode.c
... | ... | @@ -143,7 +143,7 @@ |
143 | 143 | if (S_ISREG(inode->i_mode) && oldsize != attr->size) { |
144 | 144 | if (attr->size < oldsize) |
145 | 145 | fuse_truncate(inode->i_mapping, attr->size); |
146 | - invalidate_mapping_pages(inode->i_mapping, 0, -1); | |
146 | + invalidate_inode_pages2(inode->i_mapping); | |
147 | 147 | } |
148 | 148 | } |
149 | 149 |