[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#511771: openssh-server: turn off SSHD_OOM_ADJUST for vserver/openvz



Package: openssh-server
Version: 1:5.1p1-4
Severity: wishlist
Tags: patch


See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487325
(I guess the resolution of that bug report was for sshd to
treat empty $SSHD_OOM_ADJUST the same as unset
SSHD_OOM_ADJUST)

This patch to /etc/init.d/ssh turns off SSHD_OOM_ADJUST if
attempting to write to oom_adj would just create useless log
noise.

I got the detection method from
http://osdir.com/ml/linux.openvz.user/2008-07/msg00045.html
but there might be something better.  (I don't know why the
openvz guest kernel doesn't just make oom_adj 0444 instead
of 0644.)


diff --git a/init.d/ssh b/init.d/ssh
index a1cc677..6fa37ad 100755
--- a/init.d/ssh
+++ b/init.d/ssh
@@ -21,6 +21,12 @@ if test -f /etc/default/ssh; then
     . /etc/default/ssh
 fi
 
+# are we in virtual environment that doesn't support modifying
+# /proc/self/oom_adj?
+if grep -q "envID:.*[1-9]" /proc/self/status; then
+    SSHD_OOM_ADJUST=
+fi
+
 . /lib/lsb/init-functions
 
 if [ -n "$2" ]; then



Reply to: