aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorVignesh Radhakrishnan <vigneshr@codeaurora.org>2014-10-28 18:55:16 +0530
committerZiyan <jaraidaniel@gmail.com>2016-04-03 14:56:08 +0200
commit023e74505ae1d02e5af7b7d64f229cf76940c873 (patch)
tree0bc8c1768f5ba36b3cb7615810f3c6a128597551 /fs
parentcc1c60470985a83aad1d1c2f8c2ecaf2f12cb173 (diff)
downloadkernel_samsung_tuna-023e74505ae1d02e5af7b7d64f229cf76940c873.zip
kernel_samsung_tuna-023e74505ae1d02e5af7b7d64f229cf76940c873.tar.gz
kernel_samsung_tuna-023e74505ae1d02e5af7b7d64f229cf76940c873.tar.bz2
fs: fuse: lock the new non-CMA page before replace_page_cache_page()
While swapping a page in FUSE filesystem from a CMA to non-CMA page, we call replace_page_cache_page() to swap and this function expects old and new page to be locked. Else we will hit a VM_BUG_ON in replace_page_cache_page(). Hence, lock the page before calling replace_page_cache_page() to satisfy its requirement and prevent hitting VM_BUG_ON condition. CRs-Fixed: 751088 Change-Id: I1dbb90dbaa9f056f211754bad15ae76c9d7171a5 Signed-off-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/fuse/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 18c215c..b075ed8 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -674,8 +674,10 @@ static int fuse_readpages_fill(void *_data, struct page *page)
return -ENOMEM;
}
+ lock_page(newpage);
err = replace_page_cache_page(oldpage, newpage, GFP_KERNEL);
if (err) {
+ unlock_page(newpage);
__free_page(newpage);
page_cache_release(oldpage);
return err;
@@ -685,7 +687,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
* Decrement the count on new page to make page cache the only
* owner of it
*/
- lock_page(newpage);
put_page(newpage);
/* finally release the old page and swap pointers */