On Tue, May 19, 2020 at 7:02 AM cgxu <cgxu519@xxxxxxxxxxxx> wrote: > If we don't consider that only drop negative dentry of our lookup, > it is possible to do like below, isn't it? Yes, the code looks good, though I'd consider using d_lock on dentry instead if i_lock on parent, something like this: if (d_is_negative(dentry) && dentry->d_lockref.count == 1) { spin_lock(&dentry->d_lock); /* Recheck condition under lock */ if (d_is_negative(dentry) && dentry->d_lockref.count == 1) __d_drop(dentry) spin_unlock(&dentry->d_lock); } But as Amir noted, we do need to take into account the case where lower layers are shared by multiple overlays, in which case dropping the negative dentries could result in a performance regression. Have you looked at that case, and the effect of this patch on negative dentry lookup performance? Upper layer negative dentries don't have this issue, since they are never shared, so I think it would be safe to drop them unconditionally. Thanks, Miklos