This patch fixes the behavior of the ve_printk_ratelimited helper so that "callback suppressed" messages are printed to the log buffer specified when the helper is called.
https://virtuozzo.atlassian.net/browse/VSTOR-119876 Signed-off-by: Aleksei Oladko <[email protected]> --- include/linux/printk.h | 2 +- include/linux/ratelimit_types.h | 3 +++ lib/ratelimit.c | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 8bbf98d43b93..9e784cd58f2a 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -734,7 +734,7 @@ struct pi_entry { DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_BURST); \ \ - if (__ratelimit(&_rs)) \ + if (ve_ratelimit(dst, &_rs)) \ ve_printk(dst, fmt, ##__VA_ARGS__); \ }) #else diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h index 765232ce0b5e..0c49f5419cdb 100644 --- a/include/linux/ratelimit_types.h +++ b/include/linux/ratelimit_types.h @@ -44,4 +44,7 @@ struct ratelimit_state { extern int ___ratelimit(struct ratelimit_state *rs, const char *func); #define __ratelimit(state) ___ratelimit(state, __func__) +extern int __ve_ratelimit(int dst, struct ratelimit_state *rs, const char *func); +#define ve_ratelimit(dst, state) __ve_ratelimit(dst, state, __func__) + #endif /* _LINUX_RATELIMIT_TYPES_H */ diff --git a/lib/ratelimit.c b/lib/ratelimit.c index ce945c17980b..927e47b4f4d5 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -24,7 +24,7 @@ * 0 means callbacks will be suppressed. * 1 means go ahead and do it. */ -int ___ratelimit(struct ratelimit_state *rs, const char *func) +int __ve_ratelimit(int dst, struct ratelimit_state *rs, const char *func) { /* Paired with WRITE_ONCE() in .proc_handler(). * Changing two values seperately could be inconsistent @@ -53,7 +53,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) if (time_is_before_jiffies(rs->begin + interval)) { if (rs->missed) { if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) { - printk_deferred(KERN_WARNING + ve_printk_deferred(dst, KERN_WARNING "%s: %d callbacks suppressed\n", func, rs->missed); rs->missed = 0; @@ -73,4 +73,10 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) return ret; } +EXPORT_SYMBOL(__ve_ratelimit); + +int ___ratelimit(struct ratelimit_state *rs, const char *func) +{ + return __ve_ratelimit(VE0_LOG, rs, func); +} EXPORT_SYMBOL(___ratelimit); -- 2.43.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
