Skip to contentSkip to conversation

f2fs: fix to handle error path of f2fs_ra_meta_pages()

PATCH New Chao Yu 1 participant 1 message Apr 10, 2020 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 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.

---
 fs/f2fs/checkpoint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +3 -2
index 852890b72d6a..6be357c8e002 100644
@@ -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);
Signature · 1 line
2.18.0.rc1