mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yohan Joung <jyh429@gmail.com>
To: jaegeuk@kernel.org, chao@kernel.org, daeho43@gmail.com
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Yohan Joung <yohan.joung@sk.com>
Subject: [PATCH] f2fs: prevent the current section from being selected as a victim during garbage collection
Date: Wed, 26 Mar 2025 23:14:28 +0900	[thread overview]
Message-ID: <20250326141428.280-1-yohan.joung@sk.com> (raw)

When selecting a victim using next_victim_seg in a large section, the
selected section might already have been cleared and designated as the
new current section, making it actively in use.
This behavior causes inconsistency between the SIT and SSA.

Signed-off-by: Yohan Joung <yohan.joung@sk.com>
---
 fs/f2fs/gc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 2b8f9239bede..4b5d18e395eb 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1926,6 +1926,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
 		goto stop;
 	}
 
+	if (__is_large_section(sbi) &&
+			IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, segno)))
+		goto stop;
+
 	seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type,
 				gc_control->should_migrate_blocks,
 				gc_control->one_time);
-- 
2.25.1


             reply	other threads:[~2025-03-26 14:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 14:14 Yohan Joung [this message]
2025-03-27  6:02 ` Chao Yu
2025-03-27  6:43   ` [External Mail] " 정요한(JOUNG YOHAN) Mobile AE
2025-03-27  7:29     ` Chao Yu
2025-03-27  8:00       ` [External Mail] " 정요한(JOUNG YOHAN) Mobile AE
2025-03-27 13:47         ` Chao Yu
2025-03-28  3:40           ` [f2fs-dev] " yohan.joung
2025-03-28  6:17             ` Chao Yu
2025-03-28  7:25               ` [External Mail] " yohan.joung
2025-03-28  8:00                 ` Chao Yu
2025-03-31  5:13                   ` yohan.joung
2025-03-31 11:36                     ` Chao Yu
2025-04-01  1:51                   ` yohan.joung
2025-04-01  5:41                     ` Chao Yu
2025-04-01  7:47                       ` yohan.joung
2025-04-01  8:44                         ` Chao Yu
2025-04-02  0:33                           ` yohan.joung

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=20250326141428.280-1-yohan.joung@sk.com \
    --to=jyh429@gmail.com \
    --cc=chao@kernel.org \
    --cc=daeho43@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yohan.joung@sk.com \
    /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

all inboxes | Powered by JetHome®