From: Steven Price <steven.price@arm.com>
To: "Joan Bruguera Micó" <joanbrugueram@gmail.com>,
zhengqi.arch@bytedance.com,
"Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: shrinkers: fix race condition on debugfs cleanup
Date: Mon, 3 Jul 2023 12:14:22 +0100 [thread overview]
Message-ID: <c7dbaa5e-f5ae-5dc5-4063-b8099a3058e0@arm.com> (raw)
In-Reply-To: <20230521135733.1076395-1-joanbrugueram@gmail.com>
On 21/05/2023 14:57, Joan Bruguera Micó wrote:
> On 2023/5/3 13:37, Qi Zheng wrote:
>>> +void shrinker_debugfs_remove(struct dentry *debugfs_entry, int debugfs_id)
>>> +{
>>
>> It would be better to add a check:
>>
>> if (!debugfs_entry)
>> return;
>>
>>> + debugfs_remove_recursive(debugfs_entry);
>>> + ida_free(&shrinker_debugfs_ida, debugfs_id);
>>> +}
>
> As a practical matter, both `debugfs_remove_recursive(NULL)` and
> `ida_free(_, -1);` are documented as no-ops, see:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/debugfs/inode.c?id=0dd2a6fb1e34d6dcb96806bc6b111388ad324722#n748
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc82bbf4dede758007763867d0282353c06d1121
>
> Sorry for the late reply (the patch already reached the mainline tree).
Note that commit 69cb69ea5542 ("ida: Remove assertions that an ID was
allocated") currently in linux-next makes ida_free(..., -1) illegal.
I see a crash on boot on my test platform (Firefly-RK3288) with
linux-next because of this. Qi's suggested change fixes this.
I'm not sure whether Matthew's change removing the ((int)id < 0) check
was intentional or not. Reinstating that check would also fix the crash.
Steve
next prev parent reply other threads:[~2023-07-03 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 1:32 Joan Bruguera Micó
2023-05-03 5:37 ` Qi Zheng
2023-05-21 13:57 ` Joan Bruguera Micó
2023-07-03 11:14 ` Steven Price [this message]
2023-07-26 0:08 ` Joan Bruguera Micó
2023-07-29 0:50 ` Matthew Wilcox
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=c7dbaa5e-f5ae-5dc5-4063-b8099a3058e0@arm.com \
--to=steven.price@arm.com \
--cc=akpm@linux-foundation.org \
--cc=joanbrugueram@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=roman.gushchin@linux.dev \
--cc=willy@infradead.org \
--cc=zhengqi.arch@bytedance.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