From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: [PATCH] fsck.f2fs: fix null buffer error with dev_fill
Date: Wed, 21 May 2025 12:41:00 -0700 [thread overview]
Message-ID: <20250521194100.1407220-1-daeho43@gmail.com> (raw)
From: Daeho Jeong <daehojeong@google.com>
Make fsck use dev_fill_block() with zeroed buffer instead of dev_fill().
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fsck/fsck.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 893eea7..4d05e1b 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3526,15 +3526,22 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
ret = f2fs_finish_zone(wpd->dev_index, blkz);
if (ret) {
+ u8 buffer[F2FS_BLKSIZE] = {};
+ u64 blk_addr = wp_block;
u64 fill_sects = blk_zone_length(blkz) -
(blk_zone_wp_sector(blkz) - blk_zone_sector(blkz));
+ size_t len = fill_sects >> log_sectors_per_block;
struct seg_entry *se = get_seg_entry(sbi, wp_segno);
+ enum rw_hint whint = f2fs_io_type_to_rw_hint(se->type);
+
printf("[FSCK] Finishing zone failed: %s\n", dev->path);
- ret = dev_fill(NULL, wp_block * F2FS_BLKSIZE,
- (fill_sects >> log_sectors_per_block) * F2FS_BLKSIZE,
- f2fs_io_type_to_rw_hint(se->type));
- if (ret)
- printf("[FSCK] Fill up zone failed: %s\n", dev->path);
+ while (len--) {
+ ret = dev_fill_block(buffer, blk_addr++, whint);
+ if (ret) {
+ printf("[FSCK] Fill up zone failed: %s\n", dev->path);
+ break;
+ }
+ }
}
if (!ret)
--
2.49.0.1143.g0be31eac6b-goog
next reply other threads:[~2025-05-21 19:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 19:41 Daeho Jeong [this message]
2025-05-22 3:42 ` [f2fs-dev] [PATCH] fsck.f2fs: fix null buffer error with dev_fill Chao Yu
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=20250521194100.1407220-1-daeho43@gmail.com \
--to=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--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