From: Andrew Morton <akpm@osdl.org>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
Al Viro <viro@ftp.linux.org.uk>,
linux-kernel@vger.kernel.org, nfs@lists.sourceforge.net,
Miklos Szeredi <miklos@szeredi.hu>
Subject: Re: [PATCH 1/2] VFS: Make d_materialise_unique() enforce directory uniqueness
Date: Thu, 19 Oct 2006 21:40:56 -0700 [thread overview]
Message-ID: <20061019214056.6f82641b.akpm@osdl.org> (raw)
In-Reply-To: <20061019210358.6797.64655.stgit@lade.trondhjem.org>
On Thu, 19 Oct 2006 17:03:58 -0400
Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
> +static struct dentry *__d_unalias(struct dentry *dentry, struct dentry *alias)
> +{
> + struct mutex *m1 = NULL, *m2 = NULL;
> + struct dentry *ret;
> +
> + /* If alias and dentry share a parent, then no extra locks required */
> + if (alias->d_parent == dentry->d_parent)
> + goto out_unalias;
> +
> + /* Check for loops */
> + ret = ERR_PTR(-ELOOP);
> + if (d_isparent(alias, dentry))
> + goto out_err;
> +
> + /* See lock_rename() */
> + ret = ERR_PTR(-EBUSY);
> + if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex))
> + goto out_err;
> + m1 = &dentry->d_sb->s_vfs_rename_mutex;
> + if (!mutex_trylock(&alias->d_parent->d_inode->i_mutex))
> + goto out_err;
> + m2 = &alias->d_parent->d_inode->i_mutex;
> +out_unalias:
> + d_move_locked(alias, dentry);
> + ret = alias;
> +out_err:
> + spin_unlock(&dcache_lock);
> + if (m2)
> + mutex_unlock(m2);
> + if (m1)
> + mutex_unlock(m1);
> + return ret;
> +}
The locking in there is, of course, gruesome. There is no way in which it
can be made reliable?
next prev parent reply other threads:[~2006-10-20 4:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-19 17:11 Trond Myklebust
2006-10-19 17:11 ` [PATCH 2/2] NFS: Cache invalidation fixup Trond Myklebust
2006-10-19 20:51 ` [PATCH 1/2] VFS: Make d_materialise_unique() enforce directory uniqueness Miklos Szeredi
2006-10-19 21:00 ` Trond Myklebust
2006-10-19 21:03 ` Trond Myklebust
2006-10-20 4:40 ` Andrew Morton [this message]
2006-10-20 4:54 ` Trond Myklebust
2006-10-19 21:03 ` [PATCH 2/2] NFS: Cache invalidation fixup Trond Myklebust
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=20061019214056.6f82641b.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=nfs@lists.sourceforge.net \
--cc=torvalds@osdl.org \
--cc=viro@ftp.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
all inboxes | Powered by JetHome®