diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/obd_config.c')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/obd_config.c | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 362ae541b209..2d5777699f47 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -61,7 +61,8 @@ int class_find_param(char *buf, char *key, char **valp) if (!buf) return 1; - if ((ptr = strstr(buf, key)) == NULL) + ptr = strstr(buf, key); + if (ptr == NULL) return 1; if (valp) @@ -592,7 +593,7 @@ int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg) } EXPORT_SYMBOL(class_detach); -/** Start shutting down the obd. There may be in-progess ops when +/** Start shutting down the obd. There may be in-progress ops when * this is called. We tell them to start shutting down with a call * to class_disconnect_exports(). */ @@ -655,7 +656,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) /* The three references that should be remaining are the * obd_self_export and the attach and setup references. */ if (atomic_read(&obd->obd_refcount) > 3) { - /* refcounf - 3 might be the number of real exports + /* refcount - 3 might be the number of real exports (excluding self export). But class_incref is called by other things as well, so don't count on it. */ CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n", @@ -1027,6 +1028,46 @@ struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, } EXPORT_SYMBOL(lustre_cfg_rename); +static int process_param2_config(struct lustre_cfg *lcfg) +{ + char *param = lustre_cfg_string(lcfg, 1); + char *upcall = lustre_cfg_string(lcfg, 2); + char *argv[] = { + [0] = "/usr/sbin/lctl", + [1] = "set_param", + [2] = param, + [3] = NULL + }; + struct timeval start; + struct timeval end; + int rc; + + + /* Add upcall processing here. Now only lctl is supported */ + if (strcmp(upcall, LCTL_UPCALL) != 0) { + CERROR("Unsupported upcall %s\n", upcall); + return -EINVAL; + } + + do_gettimeofday(&start); + rc = USERMODEHELPER(argv[0], argv, NULL); + do_gettimeofday(&end); + + if (rc < 0) { + CERROR( + "lctl: error invoking upcall %s %s %s: rc = %d; time %ldus\n", + argv[0], argv[1], argv[2], rc, + cfs_timeval_sub(&end, &start, NULL)); + } else { + CDEBUG(D_HA, "lctl: invoked upcall %s %s %s, time %ldus\n", + argv[0], argv[1], argv[2], + cfs_timeval_sub(&end, &start, NULL)); + rc = 0; + } + + return rc; +} + void lustre_register_quota_process_config(int (*qpc)(struct lustre_cfg *lcfg)) { quota_process_config = qpc; @@ -1142,11 +1183,14 @@ int class_process_config(struct lustre_cfg *lcfg) err = (*quota_process_config)(lcfg); GOTO(out, err); } - /* Fall through */ + break; } + case LCFG_SET_PARAM: { + err = process_param2_config(lcfg); + GOTO(out, 0); + } } - /* Commands that require a device */ obd = class_name2obd(lustre_cfg_string(lcfg, 0)); if (obd == NULL) { |