2020-04-21 20:13:52 +00:00
|
|
|
From 0ff5fd365065d431385afd38184b9555c870ce3b Mon Sep 17 00:00:00 2001
|
2019-01-11 14:52:15 +00:00
|
|
|
From: Scott Wood <swood@redhat.com>
|
|
|
|
Date: Fri, 4 Jan 2019 15:33:21 -0500
|
2020-04-21 20:13:52 +00:00
|
|
|
Subject: [PATCH 151/325] locking/rt-mutex: Flush block plug on __down_read()
|
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.115-rt48.tar.xz
|
2019-01-11 14:52:15 +00:00
|
|
|
|
|
|
|
__down_read() bypasses the rtmutex frontend to call
|
|
|
|
rt_mutex_slowlock_locked() directly, and thus it needs to call
|
|
|
|
blk_schedule_flush_flug() itself.
|
|
|
|
|
|
|
|
Cc: stable-rt@vger.kernel.org
|
|
|
|
Signed-off-by: Scott Wood <swood@redhat.com>
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
kernel/locking/rwsem-rt.c | 9 +++++++++
|
2019-01-11 14:52:15 +00:00
|
|
|
1 file changed, 9 insertions(+)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c
|
|
|
|
index 660e22caf709..f518495bd6cc 100644
|
2019-01-11 14:52:15 +00:00
|
|
|
--- a/kernel/locking/rwsem-rt.c
|
|
|
|
+++ b/kernel/locking/rwsem-rt.c
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
+#include <linux/blkdev.h>
|
|
|
|
#include <linux/rwsem.h>
|
|
|
|
#include <linux/sched/debug.h>
|
|
|
|
#include <linux/sched/signal.h>
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -87,6 +88,14 @@ static int __sched __down_read_common(struct rw_semaphore *sem, int state)
|
2019-01-11 14:52:15 +00:00
|
|
|
|
|
|
|
if (__down_read_trylock(sem))
|
|
|
|
return 0;
|
|
|
|
+ /*
|
|
|
|
+ * If rt_mutex blocks, the function sched_submit_work will not call
|
|
|
|
+ * blk_schedule_flush_plug (because tsk_is_pi_blocked would be true).
|
|
|
|
+ * We must call blk_schedule_flush_plug here, if we don't call it,
|
|
|
|
+ * a deadlock in I/O may happen.
|
|
|
|
+ */
|
|
|
|
+ if (unlikely(blk_needs_flush_plug(current)))
|
|
|
|
+ blk_schedule_flush_plug(current);
|
|
|
|
|
|
|
|
might_sleep();
|
|
|
|
raw_spin_lock_irq(&m->wait_lock);
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-04-09 19:44:24 +00:00
|
|
|
2.25.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|