linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry
@ 2024-03-08 10:12 Zhiguo Niu
  2024-03-08 10:12 ` [PATCH 2/2] f2fs: fix to handle error paths of {new,change}_curseg() Zhiguo Niu
  2024-03-11  3:54 ` [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry Chao Yu
  0 siblings, 2 replies; 6+ messages in thread
From: Zhiguo Niu @ 2024-03-08 10:12 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, zhiguo.niu, ke.wang,
	hongyu.jin

add_bio_entry should not trigger system panic when bio_add_page fail,
fix to remove it.

Fixes: 0b20fcec8651 ("f2fs: cache global IPU bio")
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/data.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d9494b5..f8ae684 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -759,8 +759,10 @@ static void add_bio_entry(struct f2fs_sb_info *sbi, struct bio *bio,
 	be->bio = bio;
 	bio_get(bio);
 
-	if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE)
-		f2fs_bug_on(sbi, 1);
+	if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) {
+		bio_put(bio);
+		return;
+	}
 
 	f2fs_down_write(&io->bio_list_lock);
 	list_add_tail(&be->list, &io->bio_list);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-11  7:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 10:12 [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry Zhiguo Niu
2024-03-08 10:12 ` [PATCH 2/2] f2fs: fix to handle error paths of {new,change}_curseg() Zhiguo Niu
2024-03-11  6:09   ` Chao Yu
2024-03-11  7:19     ` Zhiguo Niu
2024-03-11  3:54 ` [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry Chao Yu
2024-03-11  7:26   ` Zhiguo Niu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).