On Thu, Nov 07, 2024 at 08:57:23AM +0800, Yu Kuai wrote:
Hi,
在 2024/11/06 23:19, Chuck Lever III 写道:
On Nov 6, 2024, at 1:16 AM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
On Thu, Oct 24, 2024 at 09:19:41PM +0800, Yu Kuai wrote:
From: Yu Kuai <yukuai3@xxxxxxxxxx>
Fix patch is patch 27, relied patches are from:
I assume patch 27 is:
libfs: fix infinite directory reads for offset dir
https://lore.kernel.org/stable/20241024132225.2271667-12-yukuai1@xxxxxxxxxxxxxxx/
I don't think the Maple tree patches are a hard
requirement for this fix. And note that libfs did
not use Maple tree originally because I was told
at that time that Maple tree was not yet mature.
So, a better approach might be to fit the fix
onto linux-6.6.y while sticking with xarray.
The painful part is that using xarray is not acceptable, the offet
is just 32 bit and if it overflows, readdir will read nothing. That's
why maple_tree has to be used.
A 32-bit range should be entirely adequate for this usage.
- The offset allocator wraps when it reaches the maximum, it
doesn't overflow unless there are actually billions of extant
entries in the directory, which IMO is not likely.
- The offset values are dense, so the directory can use all 2- or
4- billion in the 32-bit integer range before wrapping.
- No-one complained about this limitation when offset_readdir() was
first merged. The xarray was replaced for performance reasons,
not because of the 32-bit range limit.
It is always possible that I have misunderstood your concern!