mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, wangzijie <wangzijie1@honor.com>
Subject: Re: [PATCH] f2fs: add sanity check on ei.len in __update_extent_tree_range()
Date: Thu, 18 Sep 2025 10:15:57 +0800	[thread overview]
Message-ID: <b473d03c-79d4-4c49-abe3-b41ff64982c3@kernel.org> (raw)
In-Reply-To: <aMrkjSRJ0yyEfvfl@google.com>

On 9/18/25 00:40, Jaegeuk Kim wrote:
> Do we need this?

I think so, it can provide a way to dump more information to troubleshoot
in which function we're trying to update w/ a zero-sized extent.

Thanks,

> 
> On 09/16, Chao Yu wrote:
>> Add a sanity check in __update_extent_tree_range() to detect any
>> zero-sized extent update.
>>
>> Signed-off-by: wangzijie <wangzijie1@honor.com>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>  fs/f2fs/extent_cache.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
>> index 199c1e7a83ef..3070d1cb0676 100644
>> --- a/fs/f2fs/extent_cache.c
>> +++ b/fs/f2fs/extent_cache.c
>> @@ -664,6 +664,15 @@ static void __update_extent_tree_range(struct inode *inode,
>>  	if (!et)
>>  		return;
>>  
>> +	if (unlikely(len == 0)) {
>> +		f2fs_err_ratelimited(sbi, "%s: extent len is zero, type: %d, "
>> +			"extent [%u, %u, %u], age [%llu, %llu]",
>> +			__func__, type, tei->fofs, tei->blk, tei->len,
>> +			tei->age, tei->last_blocks);
>> +		f2fs_bug_on(sbi, 1);
>> +		return;
>> +	}
>> +
>>  	if (type == EX_READ)
>>  		trace_f2fs_update_read_extent_tree_range(inode, fofs, len,
>>  						tei->blk, 0);
>> -- 
>> 2.49.0


  reply	other threads:[~2025-09-18  2:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16  8:52 Chao Yu
2025-09-17 16:40 ` Jaegeuk Kim
2025-09-18  2:15   ` Chao Yu [this message]
2025-09-29 22:30 ` [f2fs-dev] " 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=b473d03c-79d4-4c49-abe3-b41ff64982c3@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangzijie1@honor.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

Powered by JetHome