From: Giuseppe Di Natale Date: Thu, 9 Feb 2017 18:59:00 +0000 (-0800) Subject: LU-9100 lnet: lctl net down success when lnet not loaded X-Git-Tag: 2.9.54~36 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=db999716eee2ca09f7569d71cd960857ad5af0a7;hp=40fe3cd7283dfd1cee5f989483c517601ac773f8 LU-9100 lnet: lctl net down success when lnet not loaded lctl network down|unconfigure will no longer issue an error when the lnet module is not loaded. There is no network to unconfigure. Therefore, we can let the user know and exit without error. Signed-off-by: Giuseppe Di Natale Change-Id: I1eda08bd5bb0198e9d374b3b7f00306286da25cc Reviewed-on: https://review.whamcloud.com/25359 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Sonia Sharma Reviewed-by: Olaf Faaland-LLNL Reviewed-by: Oleg Drokin --- diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 808f90f..b486569 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -312,6 +312,11 @@ int jt_ptl_network(int argc, char **argv) return 0; } + if (errno == ENODEV) { + printf("LNET is currently not loaded."); + return 0; + } + if (errno == EBUSY) fprintf(stderr, "LNET busy\n"); else diff --git a/lustre/scripts/lnet b/lustre/scripts/lnet index e66ad37..10e91c9 100644 --- a/lustre/scripts/lnet +++ b/lustre/scripts/lnet @@ -52,23 +52,6 @@ run_postexec_check () fi } -stop_lnet () -{ - local errmsg=$(/usr/sbin/lctl network down 2>&1) - if [ $? -gt 0 ]; then - # The following error message means that lnet is already - # unconfigured, and the modules are not loaded. - echo $errmsg | grep "LNET unconfigure error 19" > /dev/null - if [ $? -gt 0 ]; then - return 0 - else - echo "$errmsg" - return 1 - fi - fi - return 0 -} - status () { old_nullglob="`shopt -p nullglob`" @@ -148,7 +131,7 @@ case "$1" in ;; stop) run_preexec_check "stop" - stop_lnet || exit 1 + lctl network down || exit 1 lustre_rmmod || exit 1 rm -f /var/lock/subsys/lnet run_postexec_check "stop"