From: Jan Blunck <jblunck@suse.de>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] Lookup changes to support union mount.
Date: Wed, 20 Jun 2007 07:51:58 +0000 (UTC) [thread overview]
Message-ID: <f5amau$foi$3@sea.gmane.org> (raw)
In-Reply-To: 20070620055326.GE4267@in.ibm.com
On Wed, 20 Jun 2007 11:23:26 +0530, Bharata B Rao wrote:
> +/*
> + * Looks for the given @name in dcache by walking through all the layers
> + * of the union stack, starting from the top.
> + * FIXME: If we don't find the dentry in a upper layer, we descend to the
> + * next layer. So there is a chance to miss this dentry in the top layer
> + * if this is the _first_ time lookup of the dentry in this layer. A real
> + * lookup might have fetched a valid dentry in this layer itself, while we
> + * chose to descend to the next lower layer. One solution is not have this
> + * function itself, do the toplevel lookup in dcache and if it fails proceed
> + * to real_lookup_union() directly.
> + */
> +struct dentry *__d_lookup_union(struct nameidata *nd, struct qstr *name)
> +{
> + struct dentry *dentry;
> + struct nameidata nd_tmp;
> + struct vfsmount *mnt = mntget(nd->mnt);
> + struct qstr this;
> + int err;
> +
> + nd_tmp.mnt = nd->mnt;
> + nd_tmp.dentry = nd->dentry;
> +
> + this.name = name->name;
> + this.len = name->len;
> + this.hash = name->hash;
> +
> + do {
> + /* d_hash() is a repetition for the top layer. */
> + if (nd_tmp.dentry->d_op && nd_tmp.dentry->d_op->d_hash) {
> + err = nd_tmp.dentry->d_op->d_hash(nd_tmp.dentry, &this);
> + if (err < 0)
> + goto out;
> + }
> +
> + dentry = __d_lookup(nd_tmp.dentry, &this);
> + if (dentry) {
> + if (dentry->d_inode) {
> + if (nd->mnt != nd_tmp.mnt) {
> + mntput(nd->mnt);
> + nd->mnt = mntget(nd_tmp.mnt);
> + }
> + mntput(mnt);
> + return dentry;
> + } else {
> + dput(dentry);
> + }
> + }
> + } while (next_union_mount(&nd_tmp));
> +out:
> + mntput(mnt);
> + return NULL;
> +}
> +
The reference counting for vfsmount is wrong. next_union_mount() should be
something similar to follow_down(). You should grab the reference to the
underlying mount before doing the lookup. Ok ok, you already have a valid
reference in struct union_mount but anyway.
Jan
next prev parent reply other threads:[~2007-06-20 7:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-20 5:50 [RFC PATCH 0/4] New approach to VFS based union mount Bharata B Rao
2007-06-20 5:51 ` [RFC PATCH 1/4] Union mount documentation Bharata B Rao
2007-06-20 8:11 ` Jan Blunck
2007-06-20 9:09 ` Bharata B Rao
2007-06-20 5:52 ` [RFC PATCH 2/4] Mount changes to support union mount Bharata B Rao
2007-06-20 7:47 ` Jan Blunck
2007-06-20 8:53 ` Bharata B Rao
2007-06-21 16:40 ` Josef Sipek
2007-06-20 5:53 ` [RFC PATCH 3/4] Lookup " Bharata B Rao
2007-06-20 7:51 ` Jan Blunck [this message]
2007-06-20 8:56 ` Bharata B Rao
2007-06-20 5:54 ` [RFC PATCH 4/4] Directory listing support for union mounted directories Bharata B Rao
2007-06-20 12:09 ` Christoph Hellwig
2007-06-20 14:22 ` Trond Myklebust
2007-06-20 17:02 ` Christoph Hellwig
2007-06-20 17:44 ` Trond Myklebust
2007-06-30 9:43 ` Christoph Hellwig
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='f5amau$foi$3@sea.gmane.org' \
--to=jblunck@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).