linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-fsdevel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC][PATCH] rmdir(),rename(): do shrink_dcache_parent() only on success
Date: Mon, 28 May 2018 03:48:29 +0100	[thread overview]
Message-ID: <20180528024829.GW30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <64F20BDA-00AB-429E-959E-1463AE6DCC4F@dilger.ca>

On Sun, May 27, 2018 at 08:14:30PM -0600, Andreas Dilger wrote:

> > 	if (!(flags & RENAME_EXCHANGE) && target) {
> > -		if (is_dir)
> > +		if (is_dir) {
> > +			shrink_dcache_parent(new_dentry);
> > 			target->i_flags |= S_DEAD;
> 
> Would it be better to set S_DEAD on the removed directory before
> shrink_dcache_parent() is called (here and in vfs_rmdir()), or is
> there no way for a new dentry to be added to the parent after the
> shrink is done?

It's locked (exclusive).  Lookups (as well as readdir preseeding
of dcache in case of filesystems that do it) are under the same
lock held at least shared.  The same goes for all IS_DEADDIR callers -
exact same locking is used for S_DEAD handling as well.  So the order
really doesn't matter here.

      reply	other threads:[~2018-05-28  2:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 22:20 [RFC][PATCH] rmdir(),rename(): do shrink_dcache_parent() only on success Al Viro
2018-05-27 23:04 ` Linus Torvalds
2018-05-28  2:14 ` Andreas Dilger
2018-05-28  2:48   ` Al Viro [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=20180528024829.GW30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=adilger@dilger.ca \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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).