[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <80904609-92b2-4e91-846d-d0c1c1afb513@kernel.org>
Date: Thu, 31 Jul 2025 10:37:21 +0800
From: Chao Yu <chao@...nel.org>
To: "mason.zhang" <masonzhang.linuxer@...il.com>
Cc: chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] f2fs: add error checking in do_write_page()
On 7/30/25 18:06, mason.zhang wrote:
> Otherwise, the filesystem may unaware of potential file corruption.
>
> Signed-off-by: mason.zhang <masonzhang.linuxer@...il.com>
> ---
> fs/f2fs/segment.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index ae1223ef648f..10aaa32defca 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3936,12 +3936,17 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
> int seg_type = log_type_to_seg_type(type);
> bool keep_order = (f2fs_lfs_mode(fio->sbi) &&
> seg_type == CURSEG_COLD_DATA);
> + int err;
>
> if (keep_order)
> f2fs_down_read(&fio->sbi->io_order_lock);
>
> - if (f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> - &fio->new_blkaddr, sum, type, fio)) {
> + err = f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
> + &fio->new_blkaddr, sum, type, fio);
> + if (unlikely(err)) {
> + f2fs_err_ratelimited(fio->sbi,
> + "%s Failed to allocate data block, ino:%u, type:%d, err:%d",
> + __func__, fio->ino, type, err);
Can we print page->index, old_blkaddr, new_blkaddr as well?
Thanks,
> if (fscrypt_inode_uses_fs_layer_crypto(folio->mapping->host))
> fscrypt_finalize_bounce_page(&fio->encrypted_page);
> folio_end_writeback(folio);
Powered by blists - more mailing lists