From: Baokun Li <libaokun1@huawei.com>
To: xingwei lee <xrivendell7@gmail.com>, <harperchen1110@gmail.com>
Cc: <adilger.kernel@dilger.ca>, <linux-ext4@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <syzkaller-bugs@googlegroups.com>,
<syzkaller@googlegroups.com>, <tytso@mit.edu>,
Baokun Li <libaokun1@huawei.com>,
yangerkun <yangerkun@huawei.com>
Subject: Re: divide error in mb_update_avg_fragment_size
Date: Sat, 9 Dec 2023 18:05:15 +0800 [thread overview]
Message-ID: <e39845b3-e9b4-6ad3-4c53-402628471bcc@huawei.com> (raw)
In-Reply-To: <CABOYnLwVDrhLB6yqqDgS7xixzo-OA=ZcJwBDoMPeQDMiFR7scA@mail.gmail.com>
On 2023/12/8 22:12, xingwei lee wrote:
> Hello I saw you can't reproduce this bug and I reproduce it with
> repro.c and repro.txt
> I test the repro.c in the lastest HEAD: 5e3f5b81de80c98338bcb47c233aebefee5a4801
> kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=6ae1a4ee971a7305
> and the bug also existed.
Hello xingwei!
Thanks for the reproducer!
The problem is that the same range of physical blocks are freed in
ext4_mb_release_inode_pa() and ext4_process_freed_data() successively.
Thus in mb_free_blocks() bb_free is added twice, while bb_fragments
is added only once, the second time exiting early due to checking
for release of already freed blocks. So when fstrim marks all the
blocks in the group as already used, bb_free not being 0 and
bb_fragments being 0 triggers a divide-by-zero problem in
mb_update_avg_fragment_size().
We should avoid freeing blocks in ext4_mb_release_inode_pa() that
are about to be freed in ext4_process_freed_data(). I will send out
a patch after doing some tests.
Cheers!
--
With Best Regards,
Baokun Li
.
next prev parent reply other threads:[~2023-12-09 10:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 14:12 xingwei lee
2023-12-09 10:05 ` Baokun Li [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-12-08 12:27 Wei Chen
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=e39845b3-e9b4-6ad3-4c53-402628471bcc@huawei.com \
--to=libaokun1@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=harperchen1110@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=syzkaller@googlegroups.com \
--cc=tytso@mit.edu \
--cc=xrivendell7@gmail.com \
--cc=yangerkun@huawei.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®