Skip to content

Commit 630f5dd

Browse files

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

fs/afs/file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ static void afs_invalidatepage(struct page *page, unsigned int offset,
593593
if (PagePrivate(page))
594594
afs_invalidate_dirty(page, offset, length);
595595

596+
wait_on_page_fscache(page);
596597
_leave("");
597598
}
598599

@@ -610,6 +611,14 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
610611

611612
/* deny if page is being written to the cache and the caller hasn't
612613
* elected to wait */
614+
#ifdef CONFIG_AFS_FSCACHE
615+
if (PageFsCache(page)) {
616+
if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS))
617+
return false;
618+
wait_on_page_fscache(page);
619+
}
620+
#endif
621+
613622
if (PagePrivate(page)) {
614623
detach_page_private(page);
615624
trace_afs_page_dirty(vnode, tracepoint_string("rel"), page);

fs/afs/write.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
117117
SetPageUptodate(page);
118118
}
119119

120+
#ifdef CONFIG_AFS_FSCACHE
121+
wait_on_page_fscache(page);
122+
#endif
123+
120124
try_again:
121125
/* See if this page is already partially written in a way that we can
122126
* merge the new write with.
@@ -857,6 +861,11 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf)
857861
/* Wait for the page to be written to the cache before we allow it to
858862
* be modified. We then assume the entire page will need writing back.
859863
*/
864+
#ifdef CONFIG_AFS_FSCACHE
865+
if (PageFsCache(vmf->page) &&
866+
wait_on_page_bit_killable(vmf->page, PG_fscache) < 0)
867+
return VM_FAULT_RETRY;
868+
#endif
860869

861870
if (wait_on_page_writeback_killable(vmf->page))
862871
return VM_FAULT_RETRY;
@@ -947,5 +956,6 @@ int afs_launder_page(struct page *page)
947956

948957
detach_page_private(page);
949958
trace_afs_page_dirty(vnode, tracepoint_string("laundered"), page);
959+
wait_on_page_fscache(page);
950960
return ret;
951961
}

0 commit comments

Comments
 (0)