From d22ba32ea146e2c9b70f3fce465148a4a70e2505 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 2 May 2015 10:05:35 +0200 Subject: [PATCH] scst: Avoid that a high I/O load prevents activity to be suspended Signed-off-by: Bart Van Assche --- scst/src/scst_priv.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 82aeef962..3bbdd573b 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -21,6 +21,7 @@ #include #include +#include #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) #include #endif @@ -691,6 +692,14 @@ bool __scst_check_blocked_dev(struct scst_cmd *cmd); static inline atomic_t *scst_get(void) { atomic_t *a; + + /* + * Avoid that a high I/O load prevents activity to be suspended. See + * also http://sourceforge.net/p/scst/mailman/message/34074831/. + */ + if (unlikely(test_bit(SCST_FLAG_SUSPENDING, &scst_flags))) + mdelay(100); + /* * We don't mind if we because of preemption inc counter from another * CPU as soon in the majority cases we will the correct one.