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 15:56:13 +0100	[thread overview]
Message-ID: <20130905145613.GR13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20130905142651.GB25538@tucsk.piliscsaba.szeredi.hu>

I'd probably just do this, and to hell with helper functions...

int d_set_mounted(struct dentry *dentry)
{
	struct dentry *p;
	int ret = 0;
	write_seqlock(&rename_lock);
	for (p = dentry; !IS_ROOT(p); p = p->d_parent) {
		/* Need exclusion wrt. check_submounts_and_drop() */
		spin_lock(&p->d_lock);
		if (unlikely(d_unhashed(p))) {
			spin_unlock(&p->d_lock);
			ret = -ENOENT;
			goto out;
		}
		spin_unlock(&p->d_lock);
	}
	spin_lock(&dentry->d_lock);
	dentry->d_flags |= DCACHE_MOUNTED;
 	spin_unlock(&dentry->d_lock);
out:
	write_sequnlock(&rename_lock);
	return ret;
}

  reply	other threads:[~2013-09-05 14:56 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
2013-09-05 14:26               ` Miklos Szeredi
2013-09-05 14:56                 ` Al Viro [this message]
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=20130905145613.GR13318@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).