LKML Archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 3/3] f2fs: fix false alarm on invalid block address
Date: Tue,  9 Apr 2024 20:34:11 +0000	[thread overview]
Message-ID: <20240409203411.1885121-3-jaegeuk@kernel.org> (raw)
In-Reply-To: <20240409203411.1885121-1-jaegeuk@kernel.org>

f2fs_ra_meta_pages can try to read ahead on invalid block address which is
not the corruption case.

Fixes: 31f85ccc84b8 ("f2fs: unify the error handling of f2fs_is_valid_blkaddr")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index eac698b8dd38..b01320502624 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -179,22 +179,22 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
 		break;
 	case META_SIT:
 		if (unlikely(blkaddr >= SIT_BLK_CNT(sbi)))
-			goto err;
+			goto check_only;
 		break;
 	case META_SSA:
 		if (unlikely(blkaddr >= MAIN_BLKADDR(sbi) ||
 			blkaddr < SM_I(sbi)->ssa_blkaddr))
-			goto err;
+			goto check_only;
 		break;
 	case META_CP:
 		if (unlikely(blkaddr >= SIT_I(sbi)->sit_base_addr ||
 			blkaddr < __start_cp_addr(sbi)))
-			goto err;
+			goto check_only;
 		break;
 	case META_POR:
 		if (unlikely(blkaddr >= MAX_BLKADDR(sbi) ||
 			blkaddr < MAIN_BLKADDR(sbi)))
-			goto err;
+			goto check_only;
 		break;
 	case DATA_GENERIC:
 	case DATA_GENERIC_ENHANCE:
@@ -228,6 +228,7 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
 	return true;
 err:
 	f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
+check_only:
 	return false;
 }
 
-- 
2.44.0.478.gd926399ef9-goog


  parent reply	other threads:[~2024-04-09 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 20:34 [PATCH 1/3] f2fs: use folio_test_writeback Jaegeuk Kim
2024-04-09 20:34 ` [PATCH 2/3] f2fs: clear writeback when compression failed Jaegeuk Kim
2024-04-11  9:05   ` [f2fs-dev] " Chao Yu
2024-04-12 20:57     ` Jaegeuk Kim
2024-04-16 16:49   ` [PATCH 2/3 v2] " Jaegeuk Kim
2024-04-23 19:47     ` [f2fs-dev] " Daeho Jeong
2024-04-25  2:15     ` Chao Yu
2024-04-09 20:34 ` Jaegeuk Kim [this message]
2024-04-11  9:08   ` [f2fs-dev] [PATCH 3/3] f2fs: fix false alarm on invalid block address Chao Yu
2024-04-12 20:56     ` Jaegeuk Kim
2024-04-19 10:27       ` Juhyung Park
2024-04-19 17:50         ` Jaegeuk Kim
2024-04-25  7:29         ` Chao Yu
2024-04-28  1:23           ` Daeho Jeong
2024-04-28  9:08             ` Chao Yu
2024-04-11  8:56 ` [f2fs-dev] [PATCH 1/3] f2fs: use folio_test_writeback Chao Yu
2024-04-14 15:32 ` patchwork-bot+f2fs
2024-04-24 17:40 ` patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240409203411.1885121-3-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).