linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"mszeredi@suse.cz" <mszeredi@suse.cz>,
	David Howells <dhowells@redhat.com>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 04/11] vfs: check unlinked ancestors before mount
Date: Thu, 5 Sep 2013 14:23:25 +0100	[thread overview]
Message-ID: <20130905132325.GQ13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20130905123911.GA25538@tucsk.piliscsaba.szeredi.hu>

On Thu, Sep 05, 2013 at 02:39:11PM +0200, Miklos Szeredi wrote:
> +static bool __has_unlinked_ancestor(struct dentry *dentry)
> +{
> +	struct dentry *this;
> +
> +	for (this = dentry; !IS_ROOT(this); this = this->d_parent) {
> +		int is_unhashed;
> +
> +		/* Need exclusion wrt. check_submounts_and_drop() */
> +		spin_lock(&this->d_lock);
> +		is_unhashed = d_unhashed(this);
> +		spin_unlock(&this->d_lock);
> +
> +		if (is_unhashed)
> +			return true;
> +	}
> +	return false;
> +}

I still don't get it; why do you need to bother with early setting of
DCACHE_MOUNTED?

You are grabbing rename_lock for write in d_set_mounted().  What kind of races
with check for submounts are you worried about?  d_walk() will rescan
everything if something grabs rename_lock for write while it had been running,
so just fold the "have nothing in d_subdir" case of check_submounts_and_drop()
into d_walk() and be done with that...  What's the problem with such
variant?  AFAICS, all you need to care about is d_set_mounted() not getting
between the scan for submounts and actual __d_drop() and your "finish"
callback is called only after d_walk() having grabbed d_lock *and* rechecked
rename_lock.

  reply	other threads:[~2013-09-05 13:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05  9:44 [PATCH 00/11] [v4] safely drop directory dentry on failed revalidate Miklos Szeredi
2013-09-05  9:44 ` [PATCH 01/11] vfs: restructure d_genocide() Miklos Szeredi
2013-09-05  9:44 ` [PATCH 02/11] vfs: add d_walk() Miklos Szeredi
2013-09-05  9:44 ` [PATCH 03/11] vfs: check submounts and drop atomically Miklos Szeredi
2013-09-05  9:44 ` [PATCH 04/11] vfs: check unlinked ancestors before mount Miklos Szeredi
2013-09-05 11:18   ` Al Viro
2013-09-05 11:32     ` Miklos Szeredi
2013-09-05 12:02       ` Miklos Szeredi
2013-09-05 12:03         ` Miklos Szeredi
2013-09-05 12:39           ` Miklos Szeredi
2013-09-05 13:23             ` Al Viro [this message]
2013-09-05 14:26               ` Miklos Szeredi
2013-09-05 14:56                 ` Al Viro
2013-09-05 15:52                   ` Miklos Szeredi
2013-09-05 16:07                     ` Al Viro
2013-09-05  9:44 ` [PATCH 05/11] afs: use check_submounts_and_drop() Miklos Szeredi
2013-09-05  9:44 ` [PATCH 06/11] gfs2: " Miklos Szeredi
2013-09-05  9:44 ` [PATCH 07/11] nfs: " Miklos Szeredi
2013-09-05  9:44 ` [PATCH 08/11] sysfs: " Miklos Szeredi
2013-09-05  9:44 ` [PATCH 09/11] fuse: use d_materialise_unique() Miklos Szeredi
2013-09-05  9:44 ` [PATCH 10/11] fuse: clean up return in fuse_dentry_revalidate() Miklos Szeredi
2013-09-05  9:44 ` [PATCH 11/11] fuse: drop dentry on failed revalidate Miklos Szeredi

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=20130905132325.GQ13318@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=Trond.Myklebust@netapp.com \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@suse.cz \
    --cc=swhiteho@redhat.com \
    /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).