summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-03-07 21:00:34 +0100
committerClark Williams <williams@redhat.com>2012-03-14 10:50:17 -0500
commitbaffbfe70a49f762b9fdfb3849a6ab3e62280edc (patch)
treedbf4c880fbf2e1a6ca1f1ca810b2b3d7075b7b2f
parenta6aca86c866f1f509772e276bccbb5472f61bb5c (diff)
fs: dcache: Use cpu_chill() in trylock loops
Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system make progress. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable-rt@vger.kernel.org
-rw-r--r--fs/autofs4/autofs_i.h1
-rw-r--r--fs/autofs4/expire.c2
-rw-r--r--fs/dcache.c7
3 files changed, 6 insertions, 4 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 1f89ecdefdd5..4bbe8141e55e 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -34,6 +34,7 @@
#include <linux/sched.h>
#include <linux/mount.h>
#include <linux/namei.h>
+#include <linux/delay.h>
#include <asm/current.h>
#include <asm/uaccess.h>
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index d8b6184f2e50..f4abda3720dd 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -170,7 +170,7 @@ again:
parent = p->d_parent;
if (!seq_spin_trylock(&parent->d_lock)) {
seq_spin_unlock(&p->d_lock);
- cpu_relax();
+ cpu_chill();
goto relock;
}
seq_spin_unlock(&p->d_lock);
diff --git a/fs/dcache.c b/fs/dcache.c
index 1dc71972ac47..09a7f0024bde 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -37,6 +37,7 @@
#include <linux/rculist_bl.h>
#include <linux/prefetch.h>
#include <linux/ratelimit.h>
+#include <linux/delay.h>
#include "internal.h"
/*
@@ -410,7 +411,7 @@ static inline struct dentry *dentry_kill(struct dentry *dentry, int ref)
if (inode && !spin_trylock(&inode->i_lock)) {
relock:
seq_spin_unlock(&dentry->d_lock);
- cpu_relax();
+ cpu_chill();
return dentry; /* try again with same dentry */
}
if (IS_ROOT(dentry))
@@ -796,7 +797,7 @@ relock:
if (!seq_spin_trylock(&dentry->d_lock)) {
spin_unlock(&dcache_lru_lock);
- cpu_relax();
+ cpu_chill();
goto relock;
}
@@ -1974,7 +1975,7 @@ again:
if (dentry->d_count == 1) {
if (inode && !spin_trylock(&inode->i_lock)) {
seq_spin_unlock(&dentry->d_lock);
- cpu_relax();
+ cpu_chill();
goto again;
}
dentry->d_flags &= ~DCACHE_CANT_MOUNT;