summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2019-09-22 02:43:55 +0800
committerGao Xiang <gaoxiang25@huawei.com>2019-10-01 04:54:33 +0800
commit55252ab72b774119afedfdc6d1f142ffa2a9b818 (patch)
treeb5dede17c84b402f3fde651885ddd89705a41cc8 /fs
parent6927cc05c2b067d4ca8ab6aeaa3b4544bea26ef8 (diff)
erofs: fix erofs_get_meta_page locking due to a cleanup
After doing more drop_caches stress test on our products, I found the mistake introduced by a very recent cleanup [1]. The current rule is that "erofs_get_meta_page" should be returned with page locked (although it's mostly unnecessary for read-only fs after pages are PG_uptodate), but a fix should be done for this. [1] https://lore.kernel.org/r/20190904020912.63925-26-gaoxiang25@huawei.com Fixes: 618f40ea026b ("erofs: use read_cache_page_gfp for erofs_get_meta_page") Reviewed-by: Chao Yu <yuchao0@huawei.com> Link: https://lore.kernel.org/r/20190921184355.149928-1-gaoxiang25@huawei.com Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/erofs/data.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 8a9fcbd0e8ac..fc3a8d8064f8 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -34,11 +34,15 @@ static void erofs_readendio(struct bio *bio)
struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr)
{
- struct inode *const bd_inode = sb->s_bdev->bd_inode;
- struct address_space *const mapping = bd_inode->i_mapping;
+ struct address_space *const mapping = sb->s_bdev->bd_inode->i_mapping;
+ struct page *page;
- return read_cache_page_gfp(mapping, blkaddr,
+ page = read_cache_page_gfp(mapping, blkaddr,
mapping_gfp_constraint(mapping, ~__GFP_FS));
+ /* should already be PageUptodate */
+ if (!IS_ERR(page))
+ lock_page(page);
+ return page;
}
static int erofs_map_blocks_flatmode(struct inode *inode,