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

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Thu Sep 30 14:03:49 MSK 2021


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;
-- 
2.30.2



More information about the Devel mailing list