1 From eb48fbfdea1555dbca8763fe221d42659b5f3113 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Wed, 7 Mar 2012 21:00:34 +0100
4 Subject: [PATCH 168/366] fs: dcache: Use cpu_chill() in trylock loops
6 Retry loops on RT might loop forever when the modifying side was
7 preempted. Use cpu_chill() instead of cpu_relax() to let the system
10 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
12 fs/autofs4/autofs_i.h | 1 +
13 fs/autofs4/expire.c | 2 +-
14 fs/dcache.c | 10 ++++++++--
15 fs/namespace.c | 3 ++-
16 4 files changed, 12 insertions(+), 4 deletions(-)
18 diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
19 index 502d389..05af8d3 100644
20 --- a/fs/autofs4/autofs_i.h
21 +++ b/fs/autofs4/autofs_i.h
23 #include <linux/sched.h>
24 #include <linux/mount.h>
25 #include <linux/namei.h>
26 +#include <linux/delay.h>
27 #include <asm/current.h>
28 #include <asm/uaccess.h>
30 diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
31 index 7a5a598..d08bcdc 100644
32 --- a/fs/autofs4/expire.c
33 +++ b/fs/autofs4/expire.c
34 @@ -150,7 +150,7 @@ again:
36 if (!spin_trylock(&parent->d_lock)) {
37 spin_unlock(&p->d_lock);
42 spin_unlock(&p->d_lock);
43 diff --git a/fs/dcache.c b/fs/dcache.c
44 index 9e50999..2ee5a8e6 100644
50 #include <linux/fsnotify.h>
51 +#include <linux/delay.h>
52 #include <linux/slab.h>
53 #include <linux/init.h>
54 #include <linux/hash.h>
55 @@ -785,7 +786,12 @@ repeat:
57 dentry = dentry_kill(dentry);
62 + /* the task with the highest priority won't schedule */
69 @@ -2394,7 +2400,7 @@ again:
70 if (dentry->d_lockref.count == 1) {
71 if (!spin_trylock(&inode->i_lock)) {
72 spin_unlock(&dentry->d_lock);
77 dentry->d_flags &= ~DCACHE_CANT_MOUNT;
78 diff --git a/fs/namespace.c b/fs/namespace.c
79 index 97f7f9f..1f3725b 100644
83 #include <linux/mnt_namespace.h>
84 #include <linux/user_namespace.h>
85 #include <linux/namei.h>
86 +#include <linux/delay.h>
87 #include <linux/security.h>
88 #include <linux/idr.h>
89 #include <linux/init.h> /* init_rootfs */
90 @@ -355,7 +356,7 @@ int __mnt_want_write(struct vfsmount *m)
92 while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {