On Sat, 26 Oct 2024 at 08:56, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > On Sat, Oct 26, 2024 at 08:30:54AM +0200, Amir Goldstein wrote: > > On Fri, Oct 25, 2024 at 5:02 PM Miklos Szeredi <mszeredi@xxxxxxxxxx> wrote: > > > > > > The reason for the dget/dput pair was to force the upperdentry to be > > > dropped from the cache instead of turning it negative and keeping it > > > cached. > > > > > > Simpler and cleaner way to achieve the same effect is to just drop the > > > dentry after unlink/rmdir if it was turned negative. > > > > > > Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx> > > > > Looks sane. > > Applied to overlayfs-next for testing. > > I thought it was about preventing an overlayfs objects with negative ->__upperdentry; Yeah, I overlooked that aspect. Amir, please drop this patch. > why would a negative dentry in upper layer be a problem otherwise? Double caching, see this commit: commit 1434a65ea625c51317ccdf06dabf4bd27d20fa10 Author: Chengguang Xu <cgxu519@xxxxxxxxxxxx> Date: Tue May 26 09:35:57 2020 +0800 ovl: drop negative dentry in upper layer Negative dentries of upper layer are useless after construction of overlayfs' own dentry and may keep in the memory long time even after unmount of overlayfs instance. This patch tries to drop unnecessary negative dentry of upper layer to effectively reclaim memory. The reason lower dentries are different is that lower layers could be (and often are) shared, while the upper layer is always private. Thanks, Miklos