diff options
-rw-r--r-- | mm/shmem.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 404e53bb2127..253d205914ba 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -915,6 +915,21 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) | |||
915 | struct inode *inode; | 915 | struct inode *inode; |
916 | 916 | ||
917 | BUG_ON(!PageLocked(page)); | 917 | BUG_ON(!PageLocked(page)); |
918 | /* | ||
919 | * shmem_backing_dev_info's capabilities prevent regular writeback or | ||
920 | * sync from ever calling shmem_writepage; but a stacking filesystem | ||
921 | * may use the ->writepage of its underlying filesystem, in which case | ||
922 | * we want to do nothing when that underlying filesystem is tmpfs | ||
923 | * (writing out to swap is useful as a response to memory pressure, but | ||
924 | * of no use to stabilize the data) - just redirty the page, unlock it | ||
925 | * and claim success in this case. AOP_WRITEPAGE_ACTIVATE, and the | ||
926 | * page_mapped check below, must be avoided unless we're in reclaim. | ||
927 | */ | ||
928 | if (!wbc->for_reclaim) { | ||
929 | set_page_dirty(page); | ||
930 | unlock_page(page); | ||
931 | return 0; | ||
932 | } | ||
918 | BUG_ON(page_mapped(page)); | 933 | BUG_ON(page_mapped(page)); |
919 | 934 | ||
920 | mapping = page->mapping; | 935 | mapping = page->mapping; |