2020-06-23 13:42:59 +00:00
|
|
|
From 68cde82b625232531dfec53fbef3f21141549240 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <68cde82b625232531dfec53fbef3f21141549240.1592846147.git.zanussi@kernel.org>
|
|
|
|
In-Reply-To: <07cd0dbc80b976663c80755496a03f288decfe5a.1592846146.git.zanussi@kernel.org>
|
|
|
|
References: <07cd0dbc80b976663c80755496a03f288decfe5a.1592846146.git.zanussi@kernel.org>
|
2018-08-27 14:32:32 +00:00
|
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
2019-04-08 23:49:20 +00:00
|
|
|
Date: Wed, 7 Mar 2012 21:00:34 +0100
|
2020-06-23 13:42:59 +00:00
|
|
|
Subject: [PATCH 187/330] fs: dcache: Use cpu_chill() in trylock loops
|
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.127-rt55.tar.xz
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
fs/autofs/expire.c | 3 ++-
|
|
|
|
fs/namespace.c | 8 ++++++--
|
2018-08-27 14:32:32 +00:00
|
|
|
2 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/fs/autofs/expire.c b/fs/autofs/expire.c
|
2020-01-03 23:36:11 +00:00
|
|
|
index 70e9afe589fb..1a6b88ad4fe0 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/fs/autofs/expire.c
|
|
|
|
+++ b/fs/autofs/expire.c
|
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
* option, any later version, incorporated herein by reference.
|
|
|
|
*/
|
|
|
|
|
|
|
|
+#include <linux/delay.h>
|
|
|
|
#include "autofs_i.h"
|
|
|
|
|
2018-10-30 12:40:05 +00:00
|
|
|
/* Check if a dentry can be expired */
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -153,7 +154,7 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev,
|
2018-08-27 14:32:32 +00:00
|
|
|
parent = p->d_parent;
|
|
|
|
if (!spin_trylock(&parent->d_lock)) {
|
|
|
|
spin_unlock(&p->d_lock);
|
|
|
|
- cpu_relax();
|
|
|
|
+ cpu_chill();
|
|
|
|
goto relock;
|
|
|
|
}
|
|
|
|
spin_unlock(&p->d_lock);
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/fs/namespace.c b/fs/namespace.c
|
2020-06-22 13:14:16 +00:00
|
|
|
index 741f40cd955e..df83b6e3146f 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/fs/namespace.c
|
|
|
|
+++ b/fs/namespace.c
|
|
|
|
@@ -14,6 +14,7 @@
|
|
|
|
#include <linux/mnt_namespace.h>
|
|
|
|
#include <linux/user_namespace.h>
|
|
|
|
#include <linux/namei.h>
|
|
|
|
+#include <linux/delay.h>
|
|
|
|
#include <linux/security.h>
|
|
|
|
#include <linux/cred.h>
|
|
|
|
#include <linux/idr.h>
|
2018-10-30 12:40:05 +00:00
|
|
|
@@ -327,8 +328,11 @@ int __mnt_want_write(struct vfsmount *m)
|
2018-08-27 14:32:32 +00:00
|
|
|
* incremented count after it has set MNT_WRITE_HOLD.
|
|
|
|
*/
|
|
|
|
smp_mb();
|
|
|
|
- while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD)
|
|
|
|
- cpu_relax();
|
|
|
|
+ while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {
|
|
|
|
+ preempt_enable();
|
|
|
|
+ cpu_chill();
|
|
|
|
+ preempt_disable();
|
|
|
|
+ }
|
|
|
|
/*
|
|
|
|
* After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
|
|
|
|
* be set to match its requirements. So we must not load that until
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-06-22 13:14:16 +00:00
|
|
|
2.17.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|