On 5/10/24 23:35, Yafang Shao wrote:
pointless (because the dentry won't be reused, so DCACHE_CANT_MOUNT
just won't matter).
I do worry that there are loads that actually love our current
behavior, but maybe it's worth doing the simple unconditional "make
d_delete() always unhash" and only worry about whether that causes
performance problems for people who commonly create a new file in its
place when we get such a report.
IOW, the more complex thing might be to actually take other behavior
into account (eg "do we have so many negative dentries that we really
don't want to create new ones").
This poses a substantial challenge. Despite recurrent discussions
within the community about improving negative dentry over and over,
there hasn't been a consensus on how to address it.
I had suggested in the past to have a sysctl parameter to set a
threshold on how many negative dentries (as a percentage of total system
memory) are regarded as too many and activate some processes to control
dentry creation. The hard part is to discard the oldest negative
dentries as we can have many memcg LRU lists to look at and it can be a
time consuming process. We could theoretically start removing dentries
when removing files when 50% of the threshold is reached. At 100%, we
start discarding old negative dentries. At 150%, we stop negative dentry
creation altogether.
My 2 cents.
Cheers,
Longman