All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Nick Piggin <npiggin@kernel.dk>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, u.kleine-koenig@pengutronix.de,
	"Ramirez Luna, Omar" <omar.ramirez@ti.com>
Subject: [PATCH] fs: Work around NFS wreckage
Date: Thu, 13 Jan 2011 14:54:30 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1101131436070.2678@localhost6.localdomain6> (raw)

The dcache scalability work broke NFS root filesystems.

"cd /" results in the following problem:

    link_path_walk("/",...);
	jumps to return_reval
	need_reval_dot() returns true for NFS
	d_revalidate()
		dentry->d_op->d_revalidate(dentry, nd);
		 	returns -ECHILD due to nd->flags & LOOKUP_RCU
		nameidata_dentry_drop_rcu()
			spin_lock(&parent->d_lock);
			spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);

			This deadlocks because dentry == parent

This problem exists for any filesystem which implements d_revalidate.

Uwe bisected is down to commit 34286d6(fs: rcu-walk aware d_revalidate
method), but reverting that patch causes different wreckage to show up.

Check for parent equal dentry and skip the nested lock to avoid the
deadlock. I'm sure this is the wrong fix, but at least it "works" :)

Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Reported-by: "Ramirez Luna, Omar" <omar.ramirez@ti.com>
Not-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/namei.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6/fs/namei.c
===================================================================
--- linux-2.6.orig/fs/namei.c
+++ linux-2.6/fs/namei.c
@@ -487,6 +487,8 @@ static int nameidata_dentry_drop_rcu(str
 			goto err_root;
 	}
 	spin_lock(&parent->d_lock);
+	if (parent == dentry)
+		goto same;
 	spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
 	if (!__d_rcu_to_refcount(dentry, nd->seq))
 		goto err;
@@ -499,6 +501,8 @@ static int nameidata_dentry_drop_rcu(str
 	BUG_ON(!parent->d_count);
 	parent->d_count++;
 	spin_unlock(&dentry->d_lock);
+
+same:
 	spin_unlock(&parent->d_lock);
 	if (nd->root.mnt) {
 		path_get(&nd->root);

             reply	other threads:[~2011-01-13 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 13:54 Thomas Gleixner [this message]
2011-01-13 14:10 ` [PATCH] fs: Work around NFS wreckage J. R. Okajima
2011-01-13 15:17   ` Uwe Kleine-König
2011-01-14  1:30     ` J. R. Okajima
2011-01-13 16:41   ` Thomas Gleixner
2011-01-14  1:01     ` Nick Piggin
2011-01-14  9:29       ` Thomas Gleixner
2011-01-14  9:47         ` Sedat Dilek
2011-01-14 15:47         ` Linus Torvalds
2011-01-14 16:40           ` Thomas Gleixner
2011-01-14 21:44             ` Nick Piggin
2011-01-13 14:12 ` Uwe Kleine-König

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=alpine.LFD.2.00.1101131436070.2678@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@kernel.dk \
    --cc=omar.ramirez@ti.com \
    --cc=torvalds@linux-foundation.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.