[Devel] [PATCH RHEL8 COMMIT] VE/sysrq-trigger: fix log limiting

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 30 22:08:14 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.15
------>
commit 497c495bef8653da94ce9f4a98b5e3a35eb1031e
Author: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
Date:   Thu Sep 30 22:08:14 2021 +0300

    VE/sysrq-trigger: fix log limiting
    
    Log first 10 events, not all events but 11-th.
    
    Fixes: df5ab55fa5ee ("VE/sysrq-trigger: make it VE-namespace aware")
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
    
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 drivers/tty/sysrq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 243c28e5158b..5880da6db564 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -1113,9 +1113,11 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
 			return -EFAULT;
 		if (ve_is_super(cur))
 			__handle_sysrq(c, false);
-		else if (pnum--)
+		else if (pnum > 0) {
 			printk("SysRq: CT#%s sent '%c' magic key.\n",
 				cur->ve_name, c);
+			pnum--;
+		}
 	}
 
 	return count;


More information about the Devel mailing list