diff --git a/arch/x86_64/tools/mcoverlay-create-smp-x86.sh.in b/arch/x86_64/tools/mcoverlay-create-smp-x86.sh.in index aec2ba4d..b337349c 100644 --- a/arch/x86_64/tools/mcoverlay-create-smp-x86.sh.in +++ b/arch/x86_64/tools/mcoverlay-create-smp-x86.sh.in @@ -35,7 +35,6 @@ error_exit() { ;& tmp_mcos_created) if [ "$enable_mcoverlay" == "yes" ]; then - umask $umask_old rm -rf /tmp/mcos fi ;& @@ -48,10 +47,6 @@ error_exit() { } fi -# Change umask for /proc and /sys files -umask_dec=$(( 8#${umask_old} & 8#0002 )) -umask 0`printf "%o" ${umask_dec}` - if [ ! -e /tmp/mcos ]; then mkdir -p /tmp/mcos; fi @@ -149,7 +144,3 @@ for cpuid in `find /sys/bus/cpu/devices/* -maxdepth 0 -name "cpu[0123456789]*" - rm -rf /tmp/mcos/mcos0_sys/bus/cpu/devices/$cpuid fi done - -# Restore umask -umask ${umask_old} - diff --git a/arch/x86_64/tools/mcreboot-smp-x86.sh.in b/arch/x86_64/tools/mcreboot-smp-x86.sh.in index 964e2947..b03aaa36 100644 --- a/arch/x86_64/tools/mcreboot-smp-x86.sh.in +++ b/arch/x86_64/tools/mcreboot-smp-x86.sh.in @@ -117,7 +117,6 @@ error_exit() { ;& tmp_mcos_created) if [ "$enable_mcoverlay" == "yes" ]; then - umask $umask_old rm -rf /tmp/mcos fi ;& @@ -158,6 +157,7 @@ error_exit() { rmmod ihk 2>/dev/null || echo "warning: failed to remove ihk" >&2 ;& irqbalance_stopped) + umask $umask_old if [ "`systemctl status irqbalance_mck.service 2> /dev/null |grep -E 'Active: active'`" != "" ]; then if ! systemctl stop irqbalance_mck.service 2>/dev/null; then echo "warning: failed to stop irqbalance_mck" >&2 @@ -261,6 +261,11 @@ if [ "${irqbalance_used}" == "yes" ]; then fi +# Set umask so that proc/sys files/directories created by +# mcctrl.ko and mcreboot.sh have appropriate permission bits +umask_dec=$(( 8#${umask_old} & 8#0002 )) +umask 0`printf "%o" ${umask_dec}` + # Load IHK if not loaded if ! grep -E 'ihk\s' /proc/modules &>/dev/null; then if ! taskset -c 0 insmod ${KMODDIR}/ihk.ko 2>/dev/null; then @@ -426,4 +431,7 @@ if [ "${irqbalance_used}" == "yes" ]; then # echo cpus=$cpus ncpus=$ncpus banirq=$banirq fi +# Restore umask +umask ${umask_old} + exit 0