Add a comment explaining the reason for the seemingly pointless extra reference. Suggested-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx> --- fs/overlayfs/dir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index ab65e98a1def..9e97f7dffd90 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -28,6 +28,10 @@ int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) { int err; + /* + * Cached negative upper dentries are generally not useful, so grab a + * ref to the victim to keep it from turning negative. + */ dget(wdentry); if (d_is_dir(wdentry)) err = ovl_do_rmdir(ofs, wdir, wdentry); -- 2.47.0