From: David Howells Fix the kAFS filesystem to take account of this. Signed-Off-By: David Howells Signed-off-by: Andrew Morton --- 25-akpm/fs/afs/file.c | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff -puN fs/afs/file.c~make-page-becoming-writable-notification-a-vma-op-only-kafs-fix fs/afs/file.c --- 25/fs/afs/file.c~make-page-becoming-writable-notification-a-vma-op-only-kafs-fix Mon Apr 4 14:58:36 2005 +++ 25-akpm/fs/afs/file.c Mon Apr 4 14:58:36 2005 @@ -33,8 +33,10 @@ static int afs_file_releasepage(struct p static ssize_t afs_file_write(struct file *file, const char __user *buf, size_t size, loff_t *off); +static int afs_file_mmap(struct file * file, struct vm_area_struct * vma); + #ifdef CONFIG_AFS_FSCACHE -static int afs_file_page_mkwrite(struct page *page); +static int afs_file_page_mkwrite(struct vm_area_struct *vma, struct page *page); #endif struct inode_operations afs_file_inode_operations = { @@ -44,7 +46,7 @@ struct inode_operations afs_file_inode_o struct file_operations afs_file_file_operations = { .read = generic_file_read, .write = afs_file_write, - .mmap = generic_file_mmap, + .mmap = afs_file_mmap, #if 0 .open = afs_file_open, .release = afs_file_release, @@ -58,6 +60,11 @@ struct address_space_operations afs_fs_a .set_page_dirty = __set_page_dirty_nobuffers, .releasepage = afs_file_releasepage, .invalidatepage = afs_file_invalidatepage, +}; + +struct vm_operations_struct afs_fs_vm_operations = { + .nopage = filemap_nopage, + .populate = filemap_populate, #ifdef CONFIG_AFS_FSCACHE .page_mkwrite = afs_file_page_mkwrite, #endif @@ -81,6 +88,20 @@ static ssize_t afs_file_write(struct fil /*****************************************************************************/ /* + * set up a memory mapping on an AFS file + * - we set our own VMA ops so that we can catch the page becoming writable for + * userspace for shared-writable mmap + */ +static int afs_file_mmap(struct file *file, struct vm_area_struct *vma) +{ + file_accessed(file); + vma->vm_ops = &afs_fs_vm_operations; + return 0; + +} /* end afs_file_mmap() */ + +/*****************************************************************************/ +/* * deal with notification that a page was read from the cache */ #ifdef CONFIG_AFS_FSCACHE @@ -317,10 +338,11 @@ static int afs_file_releasepage(struct p /*****************************************************************************/ /* - * wait for the disc cache to finish writing before permitting + * wait for the disc cache to finish writing before permitting modification of + * our page in the page cache */ #ifdef CONFIG_AFS_FSCACHE -static int afs_file_page_mkwrite(struct page *page) +static int afs_file_page_mkwrite(struct vm_area_struct *vma, struct page *page) { wait_on_page_fs_misc(page); return 0; _