[LU-2625] lustre_rmmod sometimes returns unexpected errors Created: 16/Jan/13  Updated: 13/Feb/13  Resolved: 13/Feb/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0, Lustre 2.1.4
Fix Version/s: Lustre 2.4.0

Type: Bug Priority: Minor
Reporter: Gregoire Pichon Assignee: Bruno Faccini (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

lustre 2.3.58
redhat 6.3


Severity: 3
Epic: modules
Rank (Obsolete): 6145

 Description   

lustre_rmmod sometimes returns errors that should not be displayed to end user.

When lustre modules are already all unloaded

# lustre_rmmod
open /proc/sys/lnet/dump_kernel failed: No such file or directory
open(dump_kernel) failed: No such file or directory

In a lustre router configuration, when loaded lustre modules are only: libcfs, lnet and lnds

# lustre_rmmod
error: dl: No such file or directory opening /proc/fs/lustre/devices
opening /dev/obd failed: No such device
hint: the kernel modules may not be loaded
Error getting device list: No such device: check dmesg.

When executed from a non-root user

$ lustre_rmmod
error: dl: No such file or directory opening /proc/fs/lustre/devices
opening /dev/obd failed: Permission denied
hint: the kernel modules may not be loaded
Error getting device list: Permission denied: check dmesg.
open /proc/sys/lnet/dump_kernel failed: Permission denied
open(dump_kernel) failed: Permission denied
Modules still loaded:
libcfs/libcfs/libcfs.o


 Comments   
Comment by Bruno Faccini (Inactive) [ 16/Jan/13 ]

Hello again Gregoire !!
Thank's for the report will give you an update soon.
Bye.

Comment by Gregoire Pichon [ 16/Jan/13 ]

I have posted a patch for the first two reported problems: http://review.whamcloud.com/5040

For the non-root user execution, I am not sure how to proceed and if it should be prevented at all.
The command /usr/sbin/lustre_rmmod permissions could be changed to 0744 (instead of 0755).
Or this could be checked directly from the script itself, like this.

# check user is root
if [ $(id -u) -ne 0 ]; then
    echo "Error: $0 must be executed as root user"
    exit 1
fi
Comment by Bruno Faccini (Inactive) [ 17/Jan/13 ]

Thank's for the patch coverring the first cases you reported.
Don't you think we also need to print an informative message in case nothing has to be done (ie, no modules to be unloaded at all, and in your version of "lustre_rmmod" when unload_dep_module() will not be called) ?
About the non-root execution, I think it is a more generic packaging issue which should be addressed apart, do you agree ??

Generated at Sat Feb 10 01:26:48 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.