Re: [PATCH V2] namei: free new_dentry late

From: Miklos Szeredi
Date: Tue Nov 27 2018 - 05:33:48 EST


On Tue, Nov 27, 2018 at 11:05 AM Jan Kara <jack@xxxxxxx> wrote:
>
> On Tue 27-11-18 17:57:12, PanBian wrote:

> > I am not quite sure about the actual execution logic. But I guess new_dentry
> > reference may be dropped outside vfs_rename in cocurrent executions.
> > Otherwise, there is no need to acquire & drop new_dentry reference as it
> > is always alive along vfs_rename.
>
> I don't think that's the case. The dget() - dput() pair just looks
> superfluous to me in vfs_rename(). Am I missing something Miklos?

I think those are to protect against d_delete() called from fs to
reset d_inode. The caller indeed has to hold one ref anyway.

So not superfluous, but only needed due to d_delete() and not to
protect against freeing of dentry.

Thanks,
Miklos