linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Miklos Szeredi <mszeredi@suse.cz>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux NFS list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] dcache: fix d_splice_alias handling of aliases
Date: Thu, 16 Jan 2014 10:41:32 -0500	[thread overview]
Message-ID: <20140116154132.GB16829@fieldses.org> (raw)
In-Reply-To: <CAJfpegs0+t4S1y9mhRMJMAERh-a95KjK_JQ7F5SRrfsNZOdoMA@mail.gmail.com>

On Wed, Jan 15, 2014 at 07:25:11PM +0100, Miklos Szeredi wrote:
> On Wed, Jan 15, 2014 at 6:57 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> > On Wed, Jan 15, 2014 at 06:34:56PM +0100, Miklos Szeredi wrote:
> >> On Wed, 2014-01-15 at 10:17 -0500, J. Bruce Fields wrote:
> >> > From: "J. Bruce Fields" <bfields@redhat.com>
> >> >
> >> > d_splice_alias can create duplicate directory aliases (in the !new
> >> > case), or (in the new case) d_move without holding appropriate locks.
> >>
> >> It can d_move, because the dentry is known to be disconnected, i.e. it
> >> doesn't have a parent for which we could obtain the lock.
> >
> > DCACHE_DISCONNECTED doesn't mean that.
> 
> You're right, but I'm also right, because __d_find_alias() will check
> IS_ROOT() too.  So only "root" disconnected dentries will be moved.

You're right, I forgot that check.

> >> One subtle difference is that for a non-directory d_splice_alias() will
> >> reconnect a DCACHE_DISCONNECTED dentry if one exists, while
> >> d_materialise_unique() will not.
...
> >> Does this matter in practice?   The small number of extra dentries
> >> probably does not matter.
> >
> > Directories are assumed to have unique aliases.  When they don't, the
> > kernel can deadlock or crash.
> 
> What I meant is that d_materialise_unique() will currently not reuse
> disconnected *nondirectory* dentries, hence there may be more aliases
> than necessary.  This could easily be fixed, though.

And, sorry, I did miss that you said "non-directory".  But I think you
have that backwards: d_splice_alias looks like:

	if (inode && S_ISDIR(inode->i_mode)) {
		...
	} else {
		d_instantiate(dentry, inode);
		if (d_unhashed(dentry))
			d_rehash(dentry);
	}

So it ignores any existing aliases in the non-directory case.

d_materialise_unique by contrast calls __d_instantiate_unique, which
looks like it should avoid adding duplicates.

So I think switching everyone to d_materialiase_unique would result in
fewer dentries.  But I've never seen any complaint about the issue and
like you don't see a reason this would matter much either way.

--b.

  reply	other threads:[~2014-01-16 15:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 15:17 [PATCH] dcache: fix d_splice_alias handling of aliases J. Bruce Fields
2014-01-15 17:34 ` Miklos Szeredi
2014-01-15 17:57   ` J. Bruce Fields
     [not found]     ` <20140115175723.GA4596-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-01-15 18:25       ` Miklos Szeredi
2014-01-16 15:41         ` J. Bruce Fields [this message]
     [not found]           ` <20140116154132.GB16829-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-01-16 16:13             ` Miklos Szeredi
     [not found] ` <20140115151749.GF23999-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-01-16 16:10   ` J. Bruce Fields
2014-01-16 16:15     ` Steven Whitehouse
2014-01-16 16:44       ` J. Bruce Fields
2014-01-16 16:54         ` Bob Peterson
2014-01-16 18:51           ` J. Bruce Fields
2014-01-17 10:04             ` Steven Whitehouse
2014-01-17 18:04               ` J. Bruce Fields
2014-01-17 12:17 ` Christoph Hellwig
     [not found]   ` <20140117121723.GA18375-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-01-17 15:39     ` J. Bruce Fields
     [not found]       ` <20140117153917.GA26636-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-01-17 21:03         ` J. Bruce Fields
     [not found]           ` <20140117210343.GD26636-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-01-17 21:26             ` J. Bruce Fields
2014-01-23 21:27               ` [PATCH] dcache: make d_splice_alias use d_materialise_unique J. Bruce Fields
2014-01-31 18:42                 ` Al Viro
2014-01-31 19:47                   ` J. Bruce Fields
     [not found]                     ` <20140131194758.GA24618-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-02-06 17:03                       ` J. Bruce Fields

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=20140116154132.GB16829@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@suse.cz \
    --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).