Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
3
-
12743
Description
The MOUNTOPT configuration variable is used in sanity.sh under the assumption that it contains only "-o optlist" where optlist is a list of options like “user_xattr” and “flock”. However, we need the "-n" option because in our configuration, /etc is on a read-only file system.
When we add "-n" to the beginning of MOUNTOPT, like this:
MOUNTOPT=“-n -o user_xattr,acl,flock"}
any place which does an “echo $MOUNTOPT” will treat the “-n” as an option to echo. For example, in the function som_mode_switch in sanity.sh:
MOUNTOPT=`echo $MOUNTOPT | sed 's/som_preview//g'`
When we add “-n” to the end of the MOUNTOPT, som_mode_switch turns MOUNTOPT into an invalid string of options to the mount command.
This line
MOUNTOPT="$MOUNTOPT,som_preview"
sets MOUNTOPT to “-o user_xattr,acl,flock -n,som_preview”, which is invalid, so the subsequent mount fails, and all subsequent tests which rely on Lustre-specific functionality (e.g. lfs setstripe) fail.
Similarly, this line, which attempts to remove the “som_preview” option
MOUNTOPT=`echo $MOUNTOPT | sed 's/som_preview//g'`
sets MOUNTOPT to “-o user_xattr,acl,flock -n,” which is invalid as well, causing the mount to fail.
I can think of a few possible solutions:
1) Don’t ever do “echo $MOUNTOPT” and ensure that “-o optlist” is at the end of MOUNTOPT (document this restriction). Instead of “echo $MOUNTOPT | sed”, we could do “sed <<<$MOUNTOPT”. This is not very robust, but it would work.
2) Add a second configuration variable, MOUNT_EXTRA, which can contain the “-n” option and leave only “-o” options in MOUNTOPT. Document this restriction. Use both MOUNT_EXTRA and MOUNTOPT in the zconf_mount and zconf_mount_clients functions.
3) Implement functions which safely add and delete options to MOUNTOPT using regular expressions with sed and grep. This seems like overkill.