From: Chao Yu Date: Fri, 10 Apr 2020 10:07:20 +0000 (+0800) Subject: f2fs: fix to handle error path of f2fs_ra_meta_pages() X-Git-Tag: v5.8-rc1~77^2~46 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ce4c638cdd52b302247434daed4c127f258d9860;p=users%2Fjedix%2Flinux-maple.git f2fs: fix to handle error path of f2fs_ra_meta_pages() In f2fs_ra_meta_pages(), if f2fs_submit_page_bio() failed, we need to unlock page, fix it. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 852890b72d6ac..6be357c8e0020 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -220,6 +220,7 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, .is_por = (type == META_POR), }; struct blk_plug plug; + int err; if (unlikely(type == META_POR)) fio.op_flags &= ~REQ_META; @@ -263,8 +264,8 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, } fio.page = page; - f2fs_submit_page_bio(&fio); - f2fs_put_page(page, 0); + err = f2fs_submit_page_bio(&fio); + f2fs_put_page(page, err ? 1 : 0); } out: blk_finish_plug(&plug);