lkml.org 
[lkml]   [2018]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectWhy does d_splice_alias need to check IS_ROOT?
Hello list,

I'm insteresting in how hard link and denry lookup work and their
implementation.

I know that this interface tries to connect an inode to a dentry, but
why does it need
to check whether the inode alias IS_ROOT if the inode represents a directory?
And the code process in different way according to check result. What
occasions
are they used for?

struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
{
if (S_ISDIR(inode->i_mode)) {
struct dentry *new = __d_find_any_alias(inode);
if (unlikely(new)) {
if (unlikely(d_ancestor(new, dentry))) {
/*the code here is to forbidden ancestor hard link*/
} else if (!IS_ROOT(new)) {
__d_unalias(inode, dentry, new);
} else {
__d_move(new, dentry, false);
}

}


}
}

Thanks in advance.

Regards,
Larry

\
 
 \ /
  Last update: 2018-05-26 18:34    [W:0.071 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site