The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: "mason.zhang" <masonzhang.linuxer@gmail.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] f2fs: add error checking in do_write_page()
Date: Thu, 31 Jul 2025 10:37:21 +0800	[thread overview]
Message-ID: <80904609-92b2-4e91-846d-d0c1c1afb513@kernel.org> (raw)
In-Reply-To: <20250730100633.26292-1-masonzhang.linuxer@gmail.com>

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@gmail.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);


      reply	other threads:[~2025-07-31  2:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 10:06 [PATCH v2] f2fs: add error checking in do_write_page() mason.zhang
2025-07-31  2:37 ` Chao Yu [this message]

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=80904609-92b2-4e91-846d-d0c1c1afb513@kernel.org \
    --to=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masonzhang.linuxer@gmail.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