On Thu, Oct 17, 2024 at 03:52:10PM +0200, Miklos Szeredi wrote: > On Thu, 17 Oct 2024 at 10:18, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > > It has been like that since the first upstream version. > > My guess is that it is an attempt to avoid turning wdentry > > into a negative dentry, which is not expected to be useful in > > ovl_clear_empty() situations, but this is just a guess. > > Yes. This was discussed in a private thread before merging overlayfs upstream. 10 years ago ;-/ Sorry, memories swapped out... |> BTW, why on the Earth are you pinning that ->__upperdentry twice? The |> comment about d_delete() makes no sense whatsoever - anything other than |> overlayfs itself would have to grab a reference to call that d_delete(), [snip] Out of curiosity, which callers pass anyone's upperdentry to ovl_cleanup()? Note that if we get dentry reference not from ovl_dentry_upper() et.al., we'll get that protection for free. From quick look it seems that the only such callchain is from ovl_clear_empty()... Oh, well... Shifting it over there would be asking for trouble later on. Might be worth a comment in ovl_cleanup() - it is subtle enough to be confusing for readers.