mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <johnstul@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: John Stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Nick Piggin <npiggin@suse.de>,
	Peter Zijlstra <peterz@infradead.org>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH -rt 2/2] Make sure d_kill sets d_parent to null
Date: Wed, 30 Jun 2010 12:12:25 -0700	[thread overview]
Message-ID: <1277925145-8355-2-git-send-email-johnstul@us.ibm.com> (raw)
In-Reply-To: <1277925145-8355-1-git-send-email-johnstul@us.ibm.com>

Patch against currrent 2.6.33-rt tree.

This patch is an alternative fix to the select_parent panic that was
suggested by Nick Piggin.

It resolves the issue by making sure d_parent is set to null so that
the dentry ascending code in select_parent will restart if the child
or next dentry was dkilled while the locks were released.

Credit and thanks to Nick for finding the solution.

Signed-off-by: John Stultz <johnstul@us.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Nick Piggin <npiggin@suse.de>
CC: Peter Zijlstra <peterz@infradead.org>
CC: John Kacur <jkacur@redhat.com>
---
 fs/dcache.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index da90157..c9d21ae 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -225,13 +225,15 @@ static struct dentry *d_kill(struct dentry *dentry)
 {
 	struct dentry *parent;
 
-	list_del(&dentry->d_u.d_child);
-	if (dentry->d_parent && dentry != dentry->d_parent)
-		spin_unlock(&dentry->d_parent->d_lock);
 	if (IS_ROOT(dentry))
 		parent = NULL;
 	else
 		parent = dentry->d_parent;
+
+	dentry->d_parent = NULL;
+	list_del(&dentry->d_u.d_child);
+	if (parent)
+		spin_unlock(&parent->d_lock);
 	/*drops the locks, at that point nobody can reach this dentry */
 	dentry_iput(dentry);
 	d_free(dentry);
-- 
1.6.0.4


      reply	other threads:[~2010-06-30 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30 19:12 [PATCH -rt 1/2] Revert select_parent locking fix John Stultz
2010-06-30 19:12 ` John Stultz [this message]

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=1277925145-8355-2-git-send-email-johnstul@us.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome