On 12/08/14 at 05:29pm, Hari Bathini wrote:
Certain kernel parameters like min_free_kbytes can be configured at
runtime
using sysctl. While this is useful in first kernel, it can lead to unnecessary
failures like OOM in kdump kernel. This patch enforces default vaules for all
sysctl parameters, in kdump kernel, by removing sysctl.conf & sysctl.d/* files.
I think this approach is reasonable, because sysctl can do evil in 2nd
kernel. The best thing to do is remove them all.
This patch looks good to me:
Acked-by: WANG Chao <chaowang(a)redhat.com>
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
dracut-module-setup.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index dcebc47..e648f91 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -378,6 +378,18 @@ kdump_install_conf() {
rm -f /tmp/$$-kdump.conf
}
+# Default sysctl parameters should suffice for kdump kernel.
+# Remove custom configurations sysctl.conf & sysctl.d/*
+remove_sysctl_conf() {
+
+ # As custom configurations like vm.min_free_kbytes can lead
+ # to OOM issues in kdump kernel, avoid them
+ rm -f "${initdir}/etc/sysctl.conf"
+ rm -rf "${initdir}/etc/sysctl.d"
+ rm -rf "${initdir}/run/sysctl.d"
+ rm -rf "${initdir}/usr/lib/sysctl.d"
+}
+
kdump_iscsi_get_rec_val() {
local result
@@ -586,6 +598,7 @@ kdump_install_random_seed() {
install() {
kdump_install_conf
+ remove_sysctl_conf
if is_ssh_dump_target; then
kdump_install_random_seed