Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79569
b: refs/heads/master
c: 8b1f9ee
h: refs/heads/master
i:
  79567: 1b88247
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jan 30, 2008
1 parent 6ab4583 commit ff9e68d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 77f111929d024165e736e919187cff017279bebe
refs/heads/master: 8b1f9ee56e21e505a3d5d3e33f823006d1abdbaf
36 changes: 14 additions & 22 deletions trunk/fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,35 +392,27 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
struct file *filp = vma->vm_file;
unsigned pagelen;
int ret = -EINVAL;
void *fsdata;
struct address_space *mapping;
loff_t offset;

lock_page(page);
mapping = page->mapping;
if (mapping != vma->vm_file->f_path.dentry->d_inode->i_mapping) {
unlock_page(page);
return -EINVAL;
}
if (mapping != vma->vm_file->f_path.dentry->d_inode->i_mapping)
goto out_unlock;

ret = 0;
pagelen = nfs_page_length(page);
offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
unlock_page(page);
if (pagelen == 0)
goto out_unlock;

/*
* we can use mapping after releasing the page lock, because:
* we hold mmap_sem on the fault path, which should pin the vma
* which should pin the file, which pins the dentry which should
* hold a reference on inode.
*/
ret = nfs_flush_incompatible(filp, page);
if (ret != 0)
goto out_unlock;

if (pagelen) {
struct page *page2 = NULL;
ret = nfs_write_begin(filp, mapping, offset, pagelen,
0, &page2, &fsdata);
if (!ret)
ret = nfs_write_end(filp, mapping, offset, pagelen,
pagelen, page2, fsdata);
}
ret = nfs_updatepage(filp, page, 0, pagelen);
if (ret == 0)
ret = pagelen;
out_unlock:
unlock_page(page);
return ret;
}

Expand Down

0 comments on commit ff9e68d

Please sign in to comment.