#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."
goto end;
}
+ /* 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:
char *upcall = lustre_cfg_string(lcfg, 2);
struct kobject *kobj = NULL;
const char *subsys = param;
+ char *newparam = NULL;
char *argv[] = {
[0] = "/usr/sbin/lctl",
[1] = "set_param",
len = strcspn(param, ".=");
if (!len)
- return -EINVAL;
+ RETURN(-EINVAL);
/* 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)
- return -ENOMEM;
+ RETURN(-ENOMEM);
kobj = kset_find_obj(lustre_kset, subsys);
kfree(subsys);
RETURN(-EINVAL);
}
+ /* 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();
rc = 0;
}
+ kfree(newparam);
RETURN(rc);
}