lctl set_param -P needs to be fixed for root squash in order
to properly propagate to clients.
On server (MDT) side, the paramaters are mdt.*.*squash*.
On client side, the parameters are llite.*.*squash*.
So if the setting on MGS side is done as
set_param -P *.*.root_squash and
*.*.nosquash_nids, it works fine. But if it is done as
set_param -P mdt.*.root_squash, this setting is not applied to
client side.
The solution is to have the settings translated into
*.*.root_squash and *.*.nosquash_nids to make both sides happy.
Also, to ensure client vs. server consistency, prevent
set_param -P llite.*.root_squash.
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I8984c9d9024d7a053e548ed15d1321b281d9940f
Reviewed-on: https://review.whamcloud.com/46739
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#define PARAM_ACTIVE "active=" /* activate/deactivate */
#define PARAM_NETWORK "network=" /* bind on nid */
#define PARAM_ID_UPCALL "identity_upcall=" /* identity upcall */
#define PARAM_ACTIVE "active=" /* activate/deactivate */
#define PARAM_NETWORK "network=" /* bind on nid */
#define PARAM_ID_UPCALL "identity_upcall=" /* identity upcall */
+#define PARAM_ROOTSQUASH "root_squash=" /* root squash */
+#define PARAM_NOSQUASHNIDS "nosquash_nids=" /* no squash nids */
/* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
#define PARAM_OST "ost."
/* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
#define PARAM_OST "ost."
+ /* root squash parameters must not be set on llite subsystem, this can
+ * lead to inconsistencies between client and server values
+ */
+ if ((strstr(ptr, PARAM_NOSQUASHNIDS) ||
+ strstr(ptr, PARAM_ROOTSQUASH)) &&
+ strncmp(ptr, "llite.", strlen("llite.")) == 0) {
+ rc = -EINVAL;
+ CWARN("%s: cannot add %s param to llite subsystem, use mdt instead: rc=%d\n",
+ mgs->mgs_obd->obd_name,
+ strstr(ptr, PARAM_ROOTSQUASH) ?
+ PARAM_ROOTSQUASH : PARAM_NOSQUASHNIDS,
+ rc);
+ goto end;
+ }
+
rc = mgs_wlp_lcfg(env, mgs, fsdb, mti, PARAMS_FILENAME, &bufs,
mti->mti_svname, ptr);
end:
rc = mgs_wlp_lcfg(env, mgs, fsdb, mti, PARAMS_FILENAME, &bufs,
mti->mti_svname, ptr);
end:
char *upcall = lustre_cfg_string(lcfg, 2);
struct kobject *kobj = NULL;
const char *subsys = param;
char *upcall = lustre_cfg_string(lcfg, 2);
struct kobject *kobj = NULL;
const char *subsys = param;
char *argv[] = {
[0] = "/usr/sbin/lctl",
[1] = "set_param",
char *argv[] = {
[0] = "/usr/sbin/lctl",
[1] = "set_param",
len = strcspn(param, ".=");
if (!len)
len = strcspn(param, ".=");
if (!len)
/* If we find '=' then its the top level sysfs directory */
if (param[len] == '=')
/* If we find '=' then its the top level sysfs directory */
if (param[len] == '=')
- return class_set_global(param);
+ RETURN(class_set_global(param));
subsys = kstrndup(param, len, GFP_KERNEL);
if (!subsys)
subsys = kstrndup(param, len, GFP_KERNEL);
if (!subsys)
kobj = kset_find_obj(lustre_kset, subsys);
kfree(subsys);
kobj = kset_find_obj(lustre_kset, subsys);
kfree(subsys);
+ /* root_squash and nosquash_nids settings must be applied to
+ * global subsystem (*.) so that it is taken into account by
+ * both client and server sides. So do the equivalent of a
+ * 's / mdt. / *. /'.
+ */
+ if ((strstr(param, PARAM_NOSQUASHNIDS) ||
+ strstr(param, PARAM_ROOTSQUASH)) &&
+ (param[0] != '*' || param[1] != '.')) {
+ newparam = kmalloc(strlen(param) + 1, GFP_NOFS);
+ if (!newparam)
+ RETURN(-ENOMEM);
+
+ snprintf(newparam, strlen(param) + 1, "*%s", param + len);
+ argv[2] = (char *)newparam;
+ }
+
start = ktime_get();
rc = call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_PROC);
end = ktime_get();
start = ktime_get();
rc = call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_PROC);
end = ktime_get();