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

Vasily Averin vvs at virtuozzo.com
Mon Oct 4 13:57:30 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.1
------>
commit 4aec67cc2b105a1aca3dfd28c65ba878b1eaff13
Author: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
Date:   Mon Oct 4 13:57:30 2021 +0300

    VE/sysrq-trigger: fix log limiting
    
    Log first 10 events, not all events but 11-th.
    
    Fixes: 9d3568f8a9bb ("VE/sysrq-trigger: make it VE-namespace aware")
    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 4228469e1632..6db02079b79f 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -1049,9 +1049,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