mcoverlay-create.sh, mcoverlay-destroy.sh: Return -EINVAL on failure

Change-Id: I0561df33e8068327bf2d921c8facac7b18ac8866
This commit is contained in:
Masamichi Takagi
2018-07-02 13:02:49 +09:00
parent 854bc85602
commit f185be06eb
4 changed files with 28 additions and 6 deletions

View File

@@ -43,7 +43,8 @@ error_exit() {
;; ;;
esac esac
exit 1 # Retun -EINVAL
exit -22
} }
fi fi
@@ -144,3 +145,5 @@ for cpuid in `find /sys/bus/cpu/devices/* -maxdepth 0 -name "cpu[0123456789]*" -
rm -rf /tmp/mcos/mcos0_sys/bus/cpu/devices/$cpuid rm -rf /tmp/mcos/mcos0_sys/bus/cpu/devices/$cpuid
fi fi
done done
exit 0

View File

@@ -8,6 +8,9 @@ if grep mcoverlay /proc/modules &>/dev/null; then
if [ -e /tmp/mcos ]; then rm -rf /tmp/mcos; fi if [ -e /tmp/mcos ]; then rm -rf /tmp/mcos; fi
if ! rmmod mcoverlay 2>/dev/null; then if ! rmmod mcoverlay 2>/dev/null; then
echo "error: removing mcoverlay" >&2 echo "error: removing mcoverlay" >&2
exit 1 # Return -EINVAL
exit -22
fi fi
fi fi
exit 0

View File

@@ -12,6 +12,7 @@
# the same set of resources as it used previously. # the same set of resources as it used previously.
# Note that the script does not output anything unless an error occurs. # Note that the script does not output anything unless an error occurs.
ret=1
prefix="@prefix@" prefix="@prefix@"
BINDIR="${prefix}/bin" BINDIR="${prefix}/bin"
SBINDIR="${prefix}/sbin" SBINDIR="${prefix}/sbin"
@@ -204,7 +205,8 @@ error_exit() {
;; ;;
esac esac
exit 1 # Propagate exit status if any
exit $ret
} }
ihk_ikc_irq_core=0 ihk_ikc_irq_core=0
@@ -255,7 +257,11 @@ fi
# Remove mcoverlay if loaded # Remove mcoverlay if loaded
if [ "$enable_mcoverlay" == "yes" ]; then if [ "$enable_mcoverlay" == "yes" ]; then
. ${SBINDIR}/mcoverlay-destroy.sh ${SBINDIR}/mcoverlay-destroy.sh
ret=$?
if [ $ret -ne 0 ]; then
error_exit "initial"
fi
fi fi
# Stop irqbalance # Stop irqbalance
@@ -458,7 +464,11 @@ fi
# Overlay /proc, /sys with McKernel specific contents # Overlay /proc, /sys with McKernel specific contents
if [ "$enable_mcoverlay" == "yes" ]; then if [ "$enable_mcoverlay" == "yes" ]; then
. ${SBINDIR}/mcoverlay-create.sh ${SBINDIR}/mcoverlay-create.sh
ret=$?
if [ $ret -ne 0 ]; then
error_exit "os_created"
fi
fi fi
# Start irqbalance with CPUs and IRQ for McKernel banned # Start irqbalance with CPUs and IRQ for McKernel banned

View File

@@ -100,7 +100,13 @@ if grep mcctrl /proc/modules &>/dev/null; then
fi fi
# Remove mcoverlay if loaded # Remove mcoverlay if loaded
. ${SBINDIR}/mcoverlay-destroy.sh ${SBINDIR}/mcoverlay-destroy.sh
ret=$?
if [ $ret -ne 0 ]; then
echo "error: mcoverlay-destroy.sh" >&2
exit $ret
fi
# Remove SMP module # Remove SMP module
if grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then if grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then