mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kmpfqgdwxucqz9@gmail.com
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	KernelKraze <admin@mail.free-proletariat.dpdns.org>
Subject: Re: [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation - WITHDRAWN
Date: Wed, 30 Jul 2025 16:20:06 +0900	[thread overview]
Message-ID: <20250730072006.154135-1-admin@mail.free-proletariat.dpdns.org> (raw)
In-Reply-To: <7d3afcb3-c5b6-4510-8d11-505c1538c786@gmx.com>

From: KernelKraze <admin@mail.free-proletariat.dpdns.org>

Hi Qu,

Thank you for the detailed technical review and correction. You are absolutely right, and I'm withdrawing this patch.

On 7/30/25 4:36 PM, Qu Wenruo wrote:
> Just as Johannes said, explain this number.
> And the magic number 195 won't cause any overflow anyway.
> [...]
> Finally, have you checked the only caller of flush_dir_items_batch()?

You've identified several fundamental issues with my patch:

1. **Misunderstanding of the caller context**: I failed to properly analyze that process_dir_items_leaf() iterates through leaf node items, where batch_size naturally corresponds to the number of directory entries in a leaf.

2. **Inappropriate limit**: The 195 limit would indeed cause false alerts on valid large directories, especially with 16K nodesize supporting 200+ directory items as you correctly calculated.

3. **Unnecessary complexity**: The integer overflow protection is not needed in this context where the count is bounded by filesystem structure limits, not user input.

4. **Architecture insensitivity**: I didn't consider systems with different page sizes where the 4K limit makes no sense.

I clearly should have done more thorough analysis of the btrfs architecture and actual usage patterns before proposing this change. Your feedback is invaluable for understanding how directory logging actually works in btrfs.

**This patch is hereby WITHDRAWN.**

Thank you for taking the time to provide such detailed technical education. I'll study the btrfs codebase more thoroughly before future contributions.

Best regards,
KernelKraze

  reply	other threads:[~2025-07-30  7:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  4:43 [PATCH 0/1] btrfs: strengthen integer overflow protection in batch allocation kmpfqgdwxucqz9
2025-07-30  4:43 ` [PATCH 1/1] btrfs: add integer overflow protection to flush_dir_items_batch allocation kmpfqgdwxucqz9
2025-07-30  6:35   ` Johannes Thumshirn
2025-07-30  6:58     ` kmpfqgdwxucqz9
2025-07-30  7:06   ` Qu Wenruo
2025-07-30  7:20     ` kmpfqgdwxucqz9 [this message]
2025-07-30 10:20   ` Filipe Manana

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=20250730072006.154135-1-admin@mail.free-proletariat.dpdns.org \
    --to=kmpfqgdwxucqz9@gmail.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=admin@mail.free-proletariat.dpdns.org \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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®