Re: [RFC] guarantee inode of alias's parent

From: Al Viro
Date: Fri Jul 07 2017 - 10:16:58 EST


On Fri, Jul 07, 2017 at 03:28:11PM +0200, Gioh Kim wrote:

> Before __d_unalias(), the dentry and parent of the dentry
> are locked. But I wonder how I can assure of existence of the
> alias and the parent of the alias.
>
> Where is the code to lock alias and alias->d_parent?

Nowhere. Why the hell would you want to lock them?

> What will happend if alias->d_parent be deleted by another process?

Huh? As soon as you've grabbed ->s_vfs_rename_mutex, ->d_parent of everything on
that filesystem is stable - and positive. Moreover, any positive dentry with
references held (in particular, anyone's parent) is going to remain such for
as long as those references are held.