[RFC 07/10] kmod: use simplified rate limit printk

From: Luis R. Rodriguez
Date: Thu Dec 08 2016 - 14:49:15 EST


Just use the simplified rate limit printk when the max modprobe
limit is reached, while at it throw out a bone should the error
be triggered.

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx>
---
kernel/kmod.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/kmod.c b/kernel/kmod.c
index 09cf35a2075a..ef65f4c3578a 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -158,7 +158,6 @@ int __request_module(bool wait, const char *fmt, ...)
va_list args;
char module_name[MODULE_NAME_LEN];
int ret;
- static int kmod_loop_msg;

/*
* We don't allow synchronous module loading from async. Module
@@ -183,13 +182,8 @@ int __request_module(bool wait, const char *fmt, ...)

ret = kmod_umh_threads_get();
if (ret) {
- /* We may be blaming an innocent here, but unlikely */
- if (kmod_loop_msg < 5) {
- printk(KERN_ERR
- "request_module: runaway loop modprobe %s\n",
- module_name);
- kmod_loop_msg++;
- }
+ pr_err_ratelimited("request_module: modprobe limit (%u) reached with module %s\n",
+ max_modprobes, module_name);
return ret;
}

--
2.10.1