[Devel] [PATCH RHEL10 COMMIT] ve: ensure network rate-limited messages go to the correct log buffer

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 1 20:43:54 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.21.vz10
------>
commit e5e39055e4e7822ffcee660542b82188227884b1
Author: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
Date:   Tue Nov 25 16:40:33 2025 +0000

    ve: ensure network rate-limited messages go to the correct log buffer
    
    This patch fixes the behavior of the net_ratelimited helper so
    that "callback suppressed" messages are printed to the log buffer
    specified when the helper is called.
    
    Fixes: c6be5cb8ae5b0 ("ve: network rate-limited VE logging helpers introduced")
    https://virtuozzo.atlassian.net/browse/VSTOR-119876
    
    Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Feature: printk: per-CT virtualization
---
 include/linux/net.h | 11 +++++++++--
 net/core/utils.c    |  6 ++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index c4f22d9352086..3f3bbe9f149d8 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -265,6 +265,7 @@ struct socket *sockfd_lookup(int fd, int *err);
 struct socket *sock_from_file(struct file *file);
 #define		     sockfd_put(sock) fput(sock->file)
 int net_ratelimit(void);
+int ve_net_ratelimit(int dst);
 
 #define net_ratelimited_function(function, ...)			\
 do {								\
@@ -272,6 +273,12 @@ do {								\
 		function(__VA_ARGS__);				\
 } while (0)
 
+#define ve_net_ratelimited_function(function, dst, ...)		\
+do {								\
+	if (ve_net_ratelimit(dst))				\
+		function(dst, __VA_ARGS__);			\
+} while (0)
+
 #define net_emerg_ratelimited(fmt, ...)				\
 	net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
 #define net_alert_ratelimited(fmt, ...)				\
@@ -305,9 +312,9 @@ do {									\
 #endif
 
 #define net_velog_ratelimited(fmt, ...)                                \
-	net_ratelimited_function(ve_printk, VE_LOG, fmt, ##__VA_ARGS__)
+	ve_net_ratelimited_function(ve_printk, VE_LOG, fmt, ##__VA_ARGS__)
 #define net_veboth_ratelimited(fmt, ...)                               \
-	net_ratelimited_function(ve_printk, VE_LOG_BOTH, fmt, ##__VA_ARGS__)
+	ve_net_ratelimited_function(ve_printk, VE_LOG_BOTH, fmt, ##__VA_ARGS__)
 
 #define net_get_random_once(buf, nbytes)			\
 	get_random_once((buf), (nbytes))
diff --git a/net/core/utils.c b/net/core/utils.c
index 27f4cffaae05d..cffc3bc44baaf 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -41,6 +41,12 @@ int net_ratelimit(void)
 }
 EXPORT_SYMBOL(net_ratelimit);
 
+int ve_net_ratelimit(int dst)
+{
+	return ve_ratelimit(dst, &net_ratelimit_state);
+}
+EXPORT_SYMBOL(ve_net_ratelimit);
+
 /*
  * Convert an ASCII string to binary IP.
  * This is outside of net/ipv4/ because various code that uses IP addresses


More information about the Devel mailing list