Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2018-07-09 18:43:31 +0800
committerColy Li <colyli@suse.de>2018-07-09 18:43:50 +0800
commit96e18b111ff169939ed7465a450db2caee8197ab (patch)
treeddb5121c2b86b8e44a35ba4707332ec34afeece5
parentd19835c7bb485043141a98d5406c8013a787ac08 (diff)
dm: fix printk() rate limiting code (bsc#1099918).
-rw-r--r--patches.suse/0001-dm-fix-printk-rate-limiting-code.patch86
-rw-r--r--series.conf1
2 files changed, 87 insertions, 0 deletions
diff --git a/patches.suse/0001-dm-fix-printk-rate-limiting-code.patch b/patches.suse/0001-dm-fix-printk-rate-limiting-code.patch
new file mode 100644
index 0000000000..b5b9c21327
--- /dev/null
+++ b/patches.suse/0001-dm-fix-printk-rate-limiting-code.patch
@@ -0,0 +1,86 @@
+From 604407890ecf624c2fb41013c82b22aade59b455 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 9 Aug 2017 11:32:11 -0700
+Subject: [PATCH] dm: fix printk() rate limiting code
+Git-commit: 604407890ecf624c2fb41013c82b22aade59b455
+Patch-mainline: v4.13
+References: bsc#1099918
+
+Using the same rate limiting state for different kinds of messages
+is wrong because this can cause a high frequency message to suppress
+a report of a low frequency message. Hence use a unique rate limiting
+state per message type.
+
+(Coly Li: keep dm_ratelimit_state to avoid KABI break)
+
+Fixes: 71a16736a15e ("dm: use local printk ratelimit")
+Cc: stable@vger.kernel.org
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Coly Li <colyli@suse.de>
+
+---
+ include/linux/device-mapper.h | 41 ++++++++++++-----------------------------
+ 1 file changed, 12 insertions(+), 29 deletions(-)
+
+--- a/include/linux/device-mapper.h
++++ b/include/linux/device-mapper.h
+@@ -549,46 +549,29 @@ void *dm_vcalloc(unsigned long nmemb, un
+ *---------------------------------------------------------------*/
+ #define DM_NAME "device-mapper"
+
+-#ifdef CONFIG_PRINTK
+-extern struct ratelimit_state dm_ratelimit_state;
+-
+-#define dm_ratelimit() __ratelimit(&dm_ratelimit_state)
+-#else
+-#define dm_ratelimit() 0
+-#endif
++#define DM_RATELIMIT(pr_func, fmt, ...) \
++do { \
++ static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, \
++ DEFAULT_RATELIMIT_BURST); \
++ \
++ if (__ratelimit(&rs)) \
++ pr_func(DM_FMT(fmt), ##__VA_ARGS__); \
++} while (0)
+
+ #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n"
+
+ #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__)
+
+ #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
+-#define DMERR_LIMIT(fmt, ...) \
+-do { \
+- if (dm_ratelimit()) \
+- DMERR(fmt, ##__VA_ARGS__); \
+-} while (0)
+-
++#define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__)
+ #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__)
+-#define DMWARN_LIMIT(fmt, ...) \
+-do { \
+- if (dm_ratelimit()) \
+- DMWARN(fmt, ##__VA_ARGS__); \
+-} while (0)
+-
++#define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__)
+ #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
+-#define DMINFO_LIMIT(fmt, ...) \
+-do { \
+- if (dm_ratelimit()) \
+- DMINFO(fmt, ##__VA_ARGS__); \
+-} while (0)
++#define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__)
+
+ #ifdef CONFIG_DM_DEBUG
+ #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
+-#define DMDEBUG_LIMIT(fmt, ...) \
+-do { \
+- if (dm_ratelimit()) \
+- DMDEBUG(fmt, ##__VA_ARGS__); \
+-} while (0)
++#define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__)
+ #else
+ #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
+ #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
diff --git a/series.conf b/series.conf
index 17bba8364e..780b151394 100644
--- a/series.conf
+++ b/series.conf
@@ -15949,6 +15949,7 @@
patches.drivers/xgene-sp3-0025-xgene-Always-get-clk-source-but-ignore-if-it-s-missi.patch
patches.drivers/net-mlx4_core-Enable-4K-UAR-if-SRIOV-module-paramete.patch
patches.drivers/IB-mlx5-Fix-Raw-Packet-QP-event-handler-assignment.patch
+ patches.suse/0001-dm-fix-printk-rate-limiting-code.patch
patches.suse/esp-Fix-memleaks-on-error-paths.patch
patches.drivers/bnxt_en-Free-MSIX-vectors-when-unregistering-the-dev.patch
patches.drivers/bnxt_en-Do-not-setup-MAC-address-in-bnxt_hwrm_func_q.patch