After using the lnetctl utility a reference count is taken on the LNet
modules. lnetctl lnet unconfigure is called in order for
lustre_rmmod to remove the LNet module.
Signed-off-by: Cyril Bordage <cbordage@whamcloud.com>
Change-Id: I7251a0c62c45da7b3cb0fddea97394b32cb6902a
Reviewed-on: https://review.whamcloud.com/41698
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
;;
stop)
run_preexec_check "stop"
;;
stop)
run_preexec_check "stop"
- lustre_rmmod ptlrpc || exit 1
- lnetctl lnet unconfigure || exit 1
- lustre_rmmod libcfs ldiskfs || exit 1
rm -f /var/lock/subsys/lnet
run_postexec_check "stop"
;;
rm -f /var/lock/subsys/lnet
run_postexec_check "stop"
;;
# unloaded if no parameters are given, or if only the ldiskfs parameter
# is given. It's ugly, but is needed to emulate the prior functionality
if [ "${#modules[@]}" -eq 0 ] || [ "${modules[*]}" = "ldiskfs" ]; then
# unloaded if no parameters are given, or if only the ldiskfs parameter
# is given. It's ugly, but is needed to emulate the prior functionality
if [ "${#modules[@]}" -eq 0 ] || [ "${modules[*]}" = "ldiskfs" ]; then
- modules=('ptlrpc' 'lnet_selftest' 'ldiskfs' 'libcfs')
+ unload_all=true
+ modules=('lnet_selftest' 'ldiskfs' 'libcfs')
+else
+ unload_all=false
fi
if [ -f /sys/kernel/debug/kmemleak ] ; then
fi
if [ -f /sys/kernel/debug/kmemleak ] ; then
$LCTL mark "$SCRIPT_NAME : Start debug"
fi
$LCTL mark "$SCRIPT_NAME : Start debug"
fi
-# LNet may have an internal ref which can prevent LND modules from
-# unloading. Try to drop it before unloading modules.
-# NB: we squelch stderr because lnetctl/lctl may complain about
-# LNet being "busy", but this is normal. We're making a best effort
-# here.
-if lsmod | grep -q lnet; then
+if $unload_all; then
+ unload_dep_modules_inclusive 'ptlrpc' || exit 1
+ # LNet may have an internal ref which can prevent LND modules from
+ # unloading. Try to drop it before unloading modules.
+ # NB: we squelch stderr because lnetctl/lctl may complain about
+ # LNet being "busy", but this is normal. We're making a best effort
+ # here.
# Prefer lnetctl if it is present
if [ -n "$(which lnetctl 2>/dev/null)" ]; then
lnetctl lnet unconfigure 2>/dev/null
# Prefer lnetctl if it is present
if [ -n "$(which lnetctl 2>/dev/null)" ]; then
lnetctl lnet unconfigure 2>/dev/null
ExecStart=/sbin/modprobe lnet
ExecStart=@sbindir@/lnetctl lnet configure
ExecStart=@sbindir@/lnetctl import @sysconfdir@/lnet.conf
ExecStart=/sbin/modprobe lnet
ExecStart=@sbindir@/lnetctl lnet configure
ExecStart=@sbindir@/lnetctl import @sysconfdir@/lnet.conf
-ExecStop=@sbindir@/lustre_rmmod ptlrpc
-ExecStop=@sbindir@/lnetctl lnet unconfigure
-ExecStop=@sbindir@/lustre_rmmod libcfs ldiskfs
+ExecStop=@sbindir@/lustre_rmmod
[Install]
WantedBy=multi-user.target
[Install]
WantedBy=multi-user.target