From: Al Viro <viro@ZenIV.linux.org.uk>
To: Michael Marineau <michael.marineau@coreos.com>
Cc: Waiman Long <Waiman.Long@hp.com>, linux-kernel@vger.kernel.org
Subject: Re: 3.12 Regression: dcache: Translating dentry into pathname without taking rename_lock 232d2d60
Date: Wed, 13 Nov 2013 12:39:47 +0000 [thread overview]
Message-ID: <20131113123947.GB13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAGr1u3vZU_Pxwu1nSab0PExNPQsE0xiSpcoMbUQ7MeGbJzBAjA@mail.gmail.com>
On Wed, Nov 13, 2013 at 03:34:13AM -0800, Michael Marineau wrote:
> Greetings,
>
> Commit 232d2d60aa5469bb097f55728f65146bd49c1d25 causes intermittent
> errors in /proc/*/fd/* where readlink returns "/" instead of the
> correct path. This can be reproduced by the script below which copies
> the kernel source directory structure while obsessively looking up
> directory fds in proc from another process. Reverting
> 232d2d60aa5469bb097f55728f65146bd49c1d25 after two related commits
> 48f5ec21d9c67e881ff35343988e290ef5cf933f
> 1812997720ab90d029548778c55d7315555e1fef fixes the issue.
Looking into it... It seems that we are getting to the end of
prepend_path() with non-negative error and bptr == *buffer.
What the...
OK, I see what's going on. We never reinitialize dentry, vfsmount and mnt
if we decide to restart. See if the following helps:
diff --git a/fs/dcache.c b/fs/dcache.c
index ae6ebb8..89f9671 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2881,9 +2881,9 @@ static int prepend_path(const struct path *path,
const struct path *root,
char **buffer, int *buflen)
{
- struct dentry *dentry = path->dentry;
- struct vfsmount *vfsmnt = path->mnt;
- struct mount *mnt = real_mount(vfsmnt);
+ struct dentry *dentry;
+ struct vfsmount *vfsmnt;
+ struct mount *mnt;
int error = 0;
unsigned seq = 0;
char *bptr;
@@ -2893,6 +2893,9 @@ static int prepend_path(const struct path *path,
restart:
bptr = *buffer;
blen = *buflen;
+ dentry = path->dentry;
+ vfsmnt = path->mnt;
+ mnt = real_mount(vfsmnt);
read_seqbegin_or_lock(&rename_lock, &seq);
while (dentry != root->dentry || vfsmnt != root->mnt) {
struct dentry * parent;
next prev parent reply other threads:[~2013-11-13 12:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 11:34 3.12 Regression: dcache: Translating dentry into pathname without taking rename_lock 232d2d60 Michael Marineau
2013-11-13 12:39 ` Al Viro [this message]
2013-11-13 14:49 ` Long, Wai Man
2013-11-13 22:51 ` Michael Marineau
2013-11-21 23:01 ` Greg KH
2013-11-21 23:16 ` Michael Marineau
2013-11-22 19:45 ` Greg KH
2013-11-21 23:22 ` Al Viro
2013-11-22 19:45 ` Greg KH
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=20131113123947.GB13318@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=Waiman.Long@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.marineau@coreos.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