From: Miklos Szeredi <miklos@szeredi.hu>
To: viro@ZenIV.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
hch@infradead.org, torvalds@linux-foundation.org,
Trond.Myklebust@netapp.com
Subject: [PATCH 2/2] vfs: dcache: use DCACHE_DENTRY_KILLED instead of DCACHE_DISCONNECTED in d_kill()
Date: Mon, 17 Sep 2012 22:31:38 +0200 [thread overview]
Message-ID: <87txuwz905.fsf@tucsk.pomaz.szeredi.hu> (raw)
In-Reply-To: <871ui01jr1.fsf@tucsk.pomaz.szeredi.hu> (Miklos Szeredi's message of "Mon, 17 Sep 2012 22:23:30 +0200")
From: Miklos Szeredi <mszeredi@suse.cz>
IBM reported a soft lockup after applying the fix for the rename_lock deadlock.
Commit c83ce989 ("VFS: Fix the nfs sillyrename regression in kernel 2.6.38") was
found to be the culprit.
The nfs sillyrename fix used DCACHE_DISCONNECTED to indicate that the dentry was
killed. This flag can be set on non-killed dentries too, which results in
infinite retries when trying to traverse the dentry tree.
This patch introduces a separate flag: DCACHE_DENTRY_KILLED, which is only set
in d_kill() and makes try_to_ascend() test only this flag.
IBM reported successful test results with this patch.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org
---
fs/dcache.c | 4 ++--
include/linux/dcache.h | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6/fs/dcache.c
===================================================================
--- linux-2.6.orig/fs/dcache.c 2012-09-17 20:04:07.000000000 +0200
+++ linux-2.6/fs/dcache.c 2012-09-17 20:04:21.000000000 +0200
@@ -389,7 +389,7 @@ static struct dentry *d_kill(struct dent
* Inform try_to_ascend() that we are no longer attached to the
* dentry tree
*/
- dentry->d_flags |= DCACHE_DISCONNECTED;
+ dentry->d_flags |= DCACHE_DENTRY_KILLED;
if (parent)
spin_unlock(&parent->d_lock);
dentry_iput(dentry);
@@ -1048,7 +1048,7 @@ static struct dentry *try_to_ascend(stru
* or deletion
*/
if (new != old->d_parent ||
- (old->d_flags & DCACHE_DISCONNECTED) ||
+ (old->d_flags & DCACHE_DENTRY_KILLED) ||
(!locked && read_seqretry(&rename_lock, seq))) {
spin_unlock(&new->d_lock);
new = NULL;
Index: linux-2.6/include/linux/dcache.h
===================================================================
--- linux-2.6.orig/include/linux/dcache.h 2012-09-17 19:56:19.000000000 +0200
+++ linux-2.6/include/linux/dcache.h 2012-09-17 20:04:21.000000000 +0200
@@ -206,6 +206,8 @@ struct dentry_operations {
#define DCACHE_MANAGED_DENTRY \
(DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
+#define DCACHE_DENTRY_KILLED 0x100000
+
extern seqlock_t rename_lock;
static inline int dname_external(struct dentry *dentry)
next prev parent reply other threads:[~2012-09-17 20:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 20:23 [PATCH 1/2] vfs: dcache: fix deadlock in tree traversal Miklos Szeredi
2012-09-17 20:31 ` Miklos Szeredi [this message]
2012-09-17 20:39 ` Al Viro
2012-09-17 22:09 ` Linus Torvalds
2012-09-18 14:53 ` Miklos Szeredi
2012-09-18 15:56 ` Linus Torvalds
2012-09-18 16:27 ` Miklos Szeredi
2012-09-18 18:22 ` Linus Torvalds
2012-09-18 20:35 ` [PATCH] trivial select_parent documentation fix J. Bruce Fields
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=87txuwz905.fsf@tucsk.pomaz.szeredi.hu \
--to=miklos@szeredi.hu \
--cc=Trond.Myklebust@netapp.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.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;
as well as URLs for NNTP newsgroup(s).