linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lei Chen <losemyheaven@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Why does d_splice_alias need to check IS_ROOT?
Date: Sun, 27 May 2018 19:09:14 +0800	[thread overview]
Message-ID: <CAKEZqK+x7MLBRFnez-XzTi3GPxoEr9p+1w25d3hkr5JLrWW2Lw@mail.gmail.com> (raw)
In-Reply-To: <20180526171206.GP30522@ZenIV.linux.org.uk>

Al Viro <viro@zeniv.linux.org.uk> 于2018年5月27日周日 上午1:12写道:

> On Sun, May 27, 2018 at 12:33:40AM +0800, Lei Chen wrote:
> > 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?

> If it's disconnected (and not an ancestor of the place where we want it),
> we can just move it in place, no questions asked.  If it is *NOT*
> disconnected, the only thing we can do is to detach it from where it
> is and move it over.  Which takes a lot more care wrt locking.

Thanks for your reply.

But why does it mean "disconnected" if IS_ROOT returns true??
Why not use hlist_unhashed(&entry->d_u.d_alias) or d_is_negative to
determine whether a dentry is connected to an inode??

I found that when we allocate a new dentry struct, its parent is not
always itself.

      reply	other threads:[~2018-05-27 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 16:33 Why does d_splice_alias need to check IS_ROOT? Lei Chen
2018-05-26 17:12 ` Al Viro
2018-05-27 11:09   ` Lei Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKEZqK+x7MLBRFnez-XzTi3GPxoEr9p+1w25d3hkr5JLrWW2Lw@mail.gmail.com \
    --to=losemyheaven@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).