From e75206a86be368811917f09a91ba63d635a928df Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Wed, 13 May 2015 13:14:18 +0300 Subject: [PATCH] Fixed openibd stop on OSes using systemd The issue caused by truescale.cmds as it was sourced from openibd and messed up environment variables causing systemd to skip the required operation. issue: http://bugs.openfabrics.org/bugzilla/show_bug.cgi?id=2534 Signed-off-by: Vladimir Sokolovsky --- compat-rdma.spec | 2 +- ofed_scripts/openibd | 16 ++++++++-------- ofed_scripts/truescale.cmds | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/compat-rdma.spec b/compat-rdma.spec index 27277e7..281541c 100755 --- a/compat-rdma.spec +++ b/compat-rdma.spec @@ -231,7 +231,7 @@ install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/ibscif-opt $RPM %endif %if %{build_qib} -install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/truescale.cmds $RPM_BUILD_ROOT/%{RDMA_CONF_DIR} +install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/truescale.cmds $RPM_BUILD_ROOT/%{RDMA_CONF_DIR} %endif %if %{build_ipoib} diff --git a/ofed_scripts/openibd b/ofed_scripts/openibd index e09ef65..a82f894 100644 --- a/ofed_scripts/openibd +++ b/ofed_scripts/openibd @@ -882,9 +882,9 @@ start() load_module ib_qib my_rc=$? if [ $my_rc -ne 0 ]; then - echo_failure $"Loading QLogic QIB driver: " - elif [ -s ${_truescale} ]; then - . ${_truescale} start + echo_failure $"Loading QLogic QIB driver: " + elif [ -x ${_truescale} ]; then + ${_truescale} start fi RC=$[ $RC + $my_rc ] fi @@ -950,9 +950,9 @@ start() load_module ocrdma my_rc=$? if [ $my_rc -ne 0 ]; then - echo_failure $"Loading Emulex One Connect driver: " - elif [ -s ${_truescale} ]; then - . ${_truescale} start + echo_failure $"Loading Emulex One Connect driver: " + elif [ -x ${_truescale} ]; then + ${_truescale} start fi RC=$[ $RC + $my_rc ] fi @@ -1227,8 +1227,8 @@ unload() sleep 2 ;; ib_qib) - if [ -s ${_truescale} ]; then - . ${_truescale} stop + if [ -x ${_truescale} ]; then + ${_truescale} stop fi if [ -d /ipathfs ]; then diff --git a/ofed_scripts/truescale.cmds b/ofed_scripts/truescale.cmds index 37d3bea..5016084 100644 --- a/ofed_scripts/truescale.cmds +++ b/ofed_scripts/truescale.cmds @@ -57,8 +57,10 @@ irqbalance_bin=/usr/sbin/irqbalance if [ -f $irqbalance_bin ]; then # Deal with different names for the irqbalance service on # different distros - service=$(rpm -ql $(rpm -qf $irqbalance_bin) 2>/dev/null | grep init.d) - service=$(basename $service) + service=$(rpm -ql $(rpm -qf $irqbalance_bin) 2>/dev/null | grep -E "init.d|systemd") + if [ -n "$service" ]; then + service=$(basename $service | sed -e "s/\.service//") + fi fi OPENIBD_CONFIG=${OPENIBD_CONFIG:-"/etc/infiniband/openib.conf"} CONFIG=$OPENIBD_CONFIG @@ -470,7 +472,9 @@ set_irq_affinity() done | sort | uniq) banned=$(echo $tbanned) set_irqs_banned "$banned" - service ${service} start + if [ -n "${service}" ]; then + service ${service} start + fi fi return } @@ -489,8 +493,8 @@ clean_irq_affinity() if [ ${balance} -eq 1 ]; then # stop irqbalance if [ -n "${service}" ]; then - service ${service} stop 2>/dev/null - [ ${?} -ne 0 ] && balance=0 + service ${service} stop 2>/dev/null + [ ${?} -ne 0 ] && balance=0 else balance=0 fi @@ -516,7 +520,9 @@ clean_irq_affinity() fi if [ ${balance} -eq 1 ]; then - ${service} start + if [ -n "${service}" ]; then + ${service} start + fi fi } -- 2.41.0