Commit 630f5dda authored by David Howells's avatar David Howells
parent bd80d8a8
...@@ -593,6 +593,7 @@ static void afs_invalidatepage(struct page *page, unsigned int offset, ...@@ -593,6 +593,7 @@ static void afs_invalidatepage(struct page *page, unsigned int offset,
if (PagePrivate(page)) if (PagePrivate(page))
afs_invalidate_dirty(page, offset, length); afs_invalidate_dirty(page, offset, length);
wait_on_page_fscache(page);
_leave(""); _leave("");
} }
...@@ -610,6 +611,14 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags) ...@@ -610,6 +611,14 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
/* deny if page is being written to the cache and the caller hasn't /* deny if page is being written to the cache and the caller hasn't
* elected to wait */ * elected to wait */
#ifdef CONFIG_AFS_FSCACHE
if (PageFsCache(page)) {
if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS))
return false;
wait_on_page_fscache(page);
}
#endif
if (PagePrivate(page)) { if (PagePrivate(page)) {
detach_page_private(page); detach_page_private(page);
trace_afs_page_dirty(vnode, tracepoint_string("rel"), page); trace_afs_page_dirty(vnode, tracepoint_string("rel"), page);
......
...@@ -117,6 +117,10 @@ int afs_write_begin(struct file *file, struct address_space *mapping, ...@@ -117,6 +117,10 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
SetPageUptodate(page); SetPageUptodate(page);
} }
#ifdef CONFIG_AFS_FSCACHE
wait_on_page_fscache(page);
#endif
try_again: try_again:
/* See if this page is already partially written in a way that we can /* See if this page is already partially written in a way that we can
* merge the new write with. * merge the new write with.
...@@ -857,6 +861,11 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) ...@@ -857,6 +861,11 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf)
/* Wait for the page to be written to the cache before we allow it to /* Wait for the page to be written to the cache before we allow it to
* be modified. We then assume the entire page will need writing back. * be modified. We then assume the entire page will need writing back.
*/ */
#ifdef CONFIG_AFS_FSCACHE
if (PageFsCache(vmf->page) &&
wait_on_page_bit_killable(vmf->page, PG_fscache) < 0)
return VM_FAULT_RETRY;
#endif
if (wait_on_page_writeback_killable(vmf->page)) if (wait_on_page_writeback_killable(vmf->page))
return VM_FAULT_RETRY; return VM_FAULT_RETRY;
...@@ -947,5 +956,6 @@ int afs_launder_page(struct page *page) ...@@ -947,5 +956,6 @@ int afs_launder_page(struct page *page)
detach_page_private(page); detach_page_private(page);
trace_afs_page_dirty(vnode, tracepoint_string("laundered"), page); trace_afs_page_dirty(vnode, tracepoint_string("laundered"), page);
wait_on_page_fscache(page);
return ret; return ret;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment