[PATCH] maple_tree: reload mas before the second call for mas_empty_area
Andrew Morton
akpm at linux-foundation.org
Sun Dec 15 22:04:57 PST 2024
On Sat, 14 Dec 2024 17:30:05 +0800 Yang Erkun <yangerkun at huaweicloud.com> wrote:
> From: Yang Erkun <yangerkun at huawei.com>
>
> Change the LONG_MAX in simple_offset_add to 1024, and do latter:
>
> [root at fedora ~]# mkdir /tmp/dir
> [root at fedora ~]# for i in {1..1024}; do touch /tmp/dir/$i; done
> touch: cannot touch '/tmp/dir/1024': Device or resource busy
> [root at fedora ~]# rm /tmp/dir/123
> [root at fedora ~]# touch /tmp/dir/1024
> [root at fedora ~]# rm /tmp/dir/100
> [root at fedora ~]# touch /tmp/dir/1025
> touch: cannot touch '/tmp/dir/1025': Device or resource busy
>
> After we delete file 100, actually this is a empty entry, but the latter
> create failed unexpected.
>
> mas_alloc_cyclic has two chance to find empty entry. First find the
> entry with range range_lo and range_hi, if no empty entry exist, and
> range_lo > min, retry find with range min and range_hi. However, the
> first call mas_empty_area may mark mas as EBUSY, and the second call for
> mas_empty_area will return false directly. Fix this by reload mas before
> second call for mas_empty_area.
>
> Fixes: 9b6713cc7522 ("maple_tree: Add mtree_alloc_cyclic()")
Am I allowed to be grumpy?
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
Signed-off-by: Christian Brauner <brauner at kernel.org>
experienced kernel developers.
MAPLE TREE
M: Liam R. Howlett <Liam.Howlett at oracle.com>
L: maple-tree at lists.infradead.org
L: linux-mm at kvack.org
MAINTAINERS.
> Signed-off-by: Yang Erkun <yangerkun at huawei.com>
Thanks, I'll queue this for review, with a cc:stable.
More information about the maple-tree
mailing list