81 lines
2.2 KiB
Diff
81 lines
2.2 KiB
Diff
|
Subject: fs: dcache: Use cpu_chill() in trylock loops
|
||
|
From: Thomas Gleixner <tglx@linutronix.de>
|
||
|
Date: Wed, 07 Mar 2012 21:00:34 +0100
|
||
|
|
||
|
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
|
||
|
---
|
||
|
fs/autofs4/autofs_i.h | 1 +
|
||
|
fs/autofs4/expire.c | 2 +-
|
||
|
fs/dcache.c | 7 ++++---
|
||
|
3 files changed, 6 insertions(+), 4 deletions(-)
|
||
|
|
||
|
Index: linux-3.2/fs/autofs4/autofs_i.h
|
||
|
===================================================================
|
||
|
--- linux-3.2.orig/fs/autofs4/autofs_i.h
|
||
|
+++ linux-3.2/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>
|
||
|
|
||
|
Index: linux-3.2/fs/autofs4/expire.c
|
||
|
===================================================================
|
||
|
--- linux-3.2.orig/fs/autofs4/expire.c
|
||
|
+++ linux-3.2/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);
|
||
|
Index: linux-3.2/fs/dcache.c
|
||
|
===================================================================
|
||
|
--- linux-3.2.orig/fs/dcache.c
|
||
|
+++ linux-3.2/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
|
||
|
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;
|