Avoid race condition when starting master

By first removing the non-native driver module and then
checking for success.
It's better to ask for forgiveness than to ask for permission.
This commit is contained in:
Bjarne von Horn 2023-11-22 16:18:01 +01:00
parent a75cc062ef
commit 9c5e477fa8
1 changed files with 5 additions and 5 deletions

View File

@ -126,12 +126,12 @@ start)
fi
if [ "${MODULE}" != "generic" ] && [ "${MODULE}" != "ccat" ]; then
# try to unload standard module
# unload standard module and check if unloading was successful
${RMMOD} "${MODULE}" 2> /dev/null || true
if ${LSMOD} | grep "^${MODULE} " > /dev/null; then
if ! ${RMMOD} "${MODULE}"; then
${RMMOD} ${LOADED_MODULES}
exit 1
fi
# could not unload module
${RMMOD} ${LOADED_MODULES}
exit 1
fi
fi