goto next;
}
- /* filter out ".bak" files */
- /* sizeof(".bak") - 1 == 3 */
- if (key_sz >= 3 &&
- !memcmp(".bak", key + key_sz - 3, 3)) {
+ /* filter out backup files */
+ if (lu_name_is_backup_file(key, key_sz, NULL)) {
CDEBUG(D_MGS, "Skipping backup file %.*s\n",
key_sz, key);
goto next;
int cfg_len = rec->lrh_len;
char *cfg_buf = (char*) (rec + 1);
struct lustre_cfg *lcfg;
- __u32 index;
+ u32 index;
int rc = 0;
ENTRY;
CDEBUG(D_INFO, "cmd %x %s %s\n", lcfg->lcfg_command,
lustre_cfg_string(lcfg, 0), lustre_cfg_string(lcfg, 1));
- /* Figure out ost indicies */
- /* lov_modify_tgts add 0:lov1 1:ost1_UUID 2(index):0 3(gen):1 */
- if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD ||
- lcfg->lcfg_command == LCFG_LOV_DEL_OBD) {
- index = simple_strtoul(lustre_cfg_string(lcfg, 2),
- NULL, 10);
+ /* Figure out ost indicies */
+ /* lov_modify_tgts add 0:lov1 1:ost1_UUID 2(index):0 3(gen):1 */
+ if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD ||
+ lcfg->lcfg_command == LCFG_LOV_DEL_OBD) {
+ rc = kstrtouint(lustre_cfg_string(lcfg, 2), 10, &index);
+ if (rc)
+ RETURN(rc);
+
CDEBUG(D_MGS, "OST index for %s is %u (%s)\n",
lustre_cfg_string(lcfg, 1), index,
lustre_cfg_string(lcfg, 2));
return 0;
}
-int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
- char *name, struct fs_db **dbh)
+/* The caller must hold mgs->mgs_mutex. */
+int mgs_find_or_make_fsdb_nolock(const struct lu_env *env,
+ struct mgs_device *mgs,
+ char *name, struct fs_db **dbh)
{
struct fs_db *fsdb;
int rc = 0;
ENTRY;
- mutex_lock(&mgs->mgs_mutex);
fsdb = mgs_find_fsdb(mgs, name);
if (!fsdb) {
fsdb = mgs_new_fsdb(env, mgs, name);
CDEBUG(D_MGS, "Created new db: rc = %d\n", rc);
}
- mutex_unlock(&mgs->mgs_mutex);
if (!rc)
*dbh = fsdb;
RETURN(rc);
}
+int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
+ char *name, struct fs_db **dbh)
+{
+ int rc;
+ ENTRY;
+
+ mutex_lock(&mgs->mgs_mutex);
+ rc = mgs_find_or_make_fsdb_nolock(env, mgs, name, dbh);
+ mutex_unlock(&mgs->mgs_mutex);
+
+ RETURN(rc);
+}
+
/* 1 = index in use
0 = index unused
-1= empty client log */
RETURN(rc);
}
+enum replace_state {
+ REPLACE_COPY = 0,
+ REPLACE_SKIP,
+ REPLACE_DONE,
+ REPLACE_UUID,
+ REPLACE_SETUP
+};
+
/** This structure is passed to mgs_replace_handler */
struct mgs_replace_data {
/* Nids are replaced for this target device */
struct mgs_target_info target;
/* Temporary modified llog */
struct llog_handle *temp_llh;
- /* Flag is set if in target block*/
- int in_target_device;
- /* Nids already added. Just skip (multiple nids) */
- int device_nids_added;
- /* Flag is set if this block should not be copied */
- int skip_it;
+ enum replace_state state;
+ char *failover;
+ char *nodeuuid;
};
/**
/* Track markers. Find given device */
if (lcfg->lcfg_command == LCFG_MARKER) {
marker = lustre_cfg_buf(lcfg, 1);
- /* Clean llog from records marked as CM_EXCLUDE.
- CM_SKIP records are used for "active" command
+ /* Clean llog from records marked as CM_SKIP.
+ CM_EXCLUDE records are used for "active" command
and can be restored if needed */
- if ((marker->cm_flags & (CM_EXCLUDE | CM_START)) ==
- (CM_EXCLUDE | CM_START)) {
- mrd->skip_it = 1;
+ if ((marker->cm_flags & (CM_SKIP | CM_START)) ==
+ (CM_SKIP | CM_START)) {
+ mrd->state = REPLACE_SKIP;
return 1;
}
- if ((marker->cm_flags & (CM_EXCLUDE | CM_END)) ==
- (CM_EXCLUDE | CM_END)) {
- mrd->skip_it = 0;
+ if ((marker->cm_flags & (CM_SKIP | CM_END)) ==
+ (CM_SKIP | CM_END)) {
+ mrd->state = REPLACE_COPY;
return 1;
}
LASSERT(!(marker->cm_flags & CM_START) ||
!(marker->cm_flags & CM_END));
if (marker->cm_flags & CM_START) {
- mrd->in_target_device = 1;
- mrd->device_nids_added = 0;
+ mrd->state = REPLACE_UUID;
+ mrd->failover = NULL;
} else if (marker->cm_flags & CM_END)
- mrd->in_target_device = 0;
+ mrd->state = REPLACE_COPY;
}
}
int nids_added = 0;
lnet_nid_t nid;
char *ptr;
- int rc;
+ int rc = 0;
- if (lcfg->lcfg_command == LCFG_ADD_UUID) {
+ if (mrd->state == REPLACE_UUID &&
+ lcfg->lcfg_command == LCFG_ADD_UUID) {
/* LCFG_ADD_UUID command found. Let's skip original command
and add passed nids */
ptr = mrd->target.mti_params;
while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+ if (!mrd->nodeuuid) {
+ rc = name_create(&mrd->nodeuuid,
+ libcfs_nid2str(nid), "");
+ if (rc) {
+ CERROR("Can't create uuid for "
+ "nid %s, device %s\n",
+ libcfs_nid2str(nid),
+ mrd->target.mti_svname);
+ return rc;
+ }
+ }
CDEBUG(D_MGS, "add nid %s with uuid %s, "
"device %s\n", libcfs_nid2str(nid),
mrd->target.mti_params,
- mrd->target.mti_svname);
+ mrd->nodeuuid);
rc = record_add_uuid(env,
mrd->temp_llh, nid,
- mrd->target.mti_params);
+ mrd->nodeuuid);
if (!rc)
nids_added++;
+
+ if (*ptr == ':') {
+ mrd->failover = ptr;
+ break;
+ }
}
if (nids_added == 0) {
CERROR("No new nids were added, nid %s with uuid %s, "
"device %s\n", libcfs_nid2str(nid),
- mrd->target.mti_params,
+ mrd->nodeuuid ? mrd->nodeuuid : "NULL",
mrd->target.mti_svname);
- RETURN(-ENXIO);
+ name_destroy(&mrd->nodeuuid);
+ return -ENXIO;
} else {
- mrd->device_nids_added = 1;
+ mrd->state = REPLACE_SETUP;
}
return nids_added;
}
- if (mrd->device_nids_added && lcfg->lcfg_command == LCFG_SETUP) {
+ if (mrd->state == REPLACE_SETUP && lcfg->lcfg_command == LCFG_SETUP) {
/* LCFG_SETUP command found. UUID should be changed */
rc = record_setup(env,
mrd->temp_llh,
lustre_cfg_string(lcfg, 0),
/* s1 is not changed */
lustre_cfg_string(lcfg, 1),
- /* new uuid should be
- the full nidlist */
- mrd->target.mti_params,
+ mrd->nodeuuid,
/* s3 is not changed */
lustre_cfg_string(lcfg, 3),
/* s4 is not changed */
lustre_cfg_string(lcfg, 4));
+
+ name_destroy(&mrd->nodeuuid);
+ if (rc)
+ return rc;
+
+ if (mrd->failover) {
+ ptr = mrd->failover;
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+ if (mrd->nodeuuid == NULL) {
+ rc = name_create(&mrd->nodeuuid,
+ libcfs_nid2str(nid),
+ "");
+ if (rc)
+ return rc;
+ }
+
+ CDEBUG(D_MGS, "add nid %s for failover %s\n",
+ libcfs_nid2str(nid), mrd->nodeuuid);
+ rc = record_add_uuid(env, mrd->temp_llh, nid,
+ mrd->nodeuuid);
+ if (rc) {
+ name_destroy(&mrd->nodeuuid);
+ return rc;
+ }
+ if (*ptr == ':') {
+ rc = record_add_conn(env,
+ mrd->temp_llh,
+ lustre_cfg_string(lcfg, 0),
+ mrd->nodeuuid);
+ name_destroy(&mrd->nodeuuid);
+ if (rc)
+ return rc;
+ }
+ }
+ if (mrd->nodeuuid) {
+ rc = record_add_conn(env, mrd->temp_llh,
+ lustre_cfg_string(lcfg, 0),
+ mrd->nodeuuid);
+ name_destroy(&mrd->nodeuuid);
+ if (rc)
+ return rc;
+ }
+ }
+ mrd->state = REPLACE_DONE;
return rc ? rc : 1;
}
}
rc = check_markers(lcfg, mrd);
- if (rc || mrd->skip_it)
+ if (rc || mrd->state == REPLACE_SKIP)
GOTO(skip_out, rc = 0);
/* Write to new log all commands outside target device block */
- if (!mrd->in_target_device)
+ if (mrd->state == REPLACE_COPY)
GOTO(copy_out, rc = 0);
- /* Skip all other LCFG_ADD_UUID and LCFG_ADD_CONN records
- (failover nids) for this target, assuming that if then
- primary is changing then so is the failover */
- if (mrd->device_nids_added &&
+ if (mrd->state == REPLACE_DONE &&
(lcfg->lcfg_command == LCFG_ADD_UUID ||
- lcfg->lcfg_command == LCFG_ADD_CONN))
+ lcfg->lcfg_command == LCFG_ADD_CONN)) {
+ if (!mrd->failover)
+ CWARN("Previous failover is deleted, but new one is "
+ "not set. This means you configure system "
+ "without failover or passed wrong replace_nids "
+ "command parameters. Device %s, passed nids %s\n",
+ mrd->target.mti_svname, mrd->target.mti_params);
GOTO(skip_out, rc = 0);
+ }
rc = process_command(env, lcfg, mrd);
if (rc < 0)
/* skip self export */
if (exp == mgs_obd->obd_self_export)
continue;
- if (exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS)
- continue;
++num_exports;
- CERROR("%s: node %s still connected during replace_nids "
- "connect_flags:%llx\n",
- mgs_obd->obd_name,
- libcfs_nid2str(exp->exp_nid_stats->nid),
- exp_connect_flags(exp));
-
+ if (num_exports > 1)
+ CERROR("%s: node %s still connected during replace_nids connect_flags:%llx\n",
+ mgs_obd->obd_name,
+ libcfs_nid2str(exp->exp_nid_stats->nid),
+ exp_connect_flags(exp));
}
spin_unlock(&mgs_obd->obd_dev_lock);
- /* osd, MGS and MGC + self_export
- (wc -l /proc/fs/lustre/devices <= 2) && (non self exports == 0) */
- return (num_devices <= 3) && (num_exports == 0);
+ /* osd, MGS and MGC + MGC export (nosvc starts MGC)
+ * (wc -l /proc/fs/lustre/devices <= 3) && (non self exports == 1)
+ */
+ return (num_devices <= 3) && (num_exports <= 1);
}
-static int name_create_mdt(char **logname, char *fsname, int i)
+static int name_create_mdt(char **logname, char *fsname, int mdt_idx)
{
- char mdt_index[9];
+ char postfix[9];
- sprintf(mdt_index, "-MDT%04x", i);
- return name_create(logname, fsname, mdt_index);
+ if (mdt_idx > INDEX_MAP_MAX_VALUE)
+ return -E2BIG;
+
+ snprintf(postfix, sizeof(postfix), "-MDT%04x", mdt_idx);
+ return name_create(logname, fsname, postfix);
}
/**
}
/* Process client llogs */
- name_create(&logname, fsname, "-client");
+ rc = name_create(&logname, fsname, "-client");
+ if (rc)
+ GOTO(out, rc);
rc = mgs_replace_nids_log(env, mgs_obd, logname, devname, nids);
name_destroy(&logname);
if (rc) {
for (i = 0; i < INDEX_MAP_SIZE * 8; i++) {
if (!test_bit(i, fsdb->fsdb_mdt_index_map))
continue;
- name_create_mdt(&logname, fsname, i);
+ rc = name_create_mdt(&logname, fsname, i);
+ if (rc)
+ GOTO(out, rc);
rc = mgs_replace_nids_log(env, mgs_obd, logname, devname, nids);
name_destroy(&logname);
if (rc)
marker = lustre_cfg_buf(lcfg, 1);
if (marker->cm_flags & CM_SKIP) {
if (marker->cm_flags & CM_START)
- mrd->skip_it = 1;
+ mrd->state = REPLACE_SKIP;
if (marker->cm_flags & CM_END)
- mrd->skip_it = 0;
+ mrd->state = REPLACE_COPY;
/* SKIP section started or finished */
CDEBUG(D_MGS, "Skip idx=%d, rc=%d, len=%d, "
"cmd %x %s %s\n", rec->lrh_index, rc,
RETURN(0);
}
} else {
- if (mrd->skip_it) {
+ if (mrd->state == REPLACE_SKIP) {
/* record enclosed between SKIP markers, skip it */
CDEBUG(D_MGS, "Skip idx=%d, rc=%d, len=%d, "
"cmd %x %s %s\n", rec->lrh_index, rc,
{
char *log = mti->mti_svname;
struct llog_handle *llh = NULL;
- char *uuid, *lovname;
+ struct obd_uuid *uuid;
+ char *lovname;
char mdt_index[6];
char *ptr = mti->mti_params;
int rc = 0, failout = 0;
ENTRY;
- OBD_ALLOC(uuid, sizeof(struct obd_uuid));
+ OBD_ALLOC_PTR(uuid);
if (uuid == NULL)
RETURN(-ENOMEM);
/* add MDT itself */
/* FIXME this whole fn should be a single journal transaction */
- sprintf(uuid, "%s_UUID", log);
+ sprintf(uuid->uuid, "%s_UUID", log);
rc = record_marker(env, llh, fsdb, CM_START, log, "add mdt");
if (rc)
GOTO(out_lod, rc);
- rc = record_attach(env, llh, log, LUSTRE_MDT_NAME, uuid);
+ rc = record_attach(env, llh, log, LUSTRE_MDT_NAME, uuid->uuid);
if (rc)
GOTO(out_end, rc);
rc = record_mount_opt(env, llh, log, lovname, NULL);
if (rc)
GOTO(out_end, rc);
- rc = record_setup(env, llh, log, uuid, mdt_index, lovname,
+ rc = record_setup(env, llh, log, uuid->uuid, mdt_index, lovname,
failout ? "n" : "f");
if (rc)
GOTO(out_end, rc);
out_lod:
name_destroy(&lovname);
out_free:
- OBD_FREE(uuid, sizeof(struct obd_uuid));
+ OBD_FREE_PTR(uuid);
RETURN(rc);
}
/* Add ost to all MDT lov defs */
for (i = 0; i < INDEX_MAP_SIZE * 8; i++){
if (test_bit(i, fsdb->fsdb_mdt_index_map)) {
- char mdt_index[9];
+ char mdt_index[13];
rc = name_create_mdt_and_lov(&logname, &lovname, fsdb,
i);
if (rc)
RETURN(rc);
- sprintf(mdt_index, "-MDT%04x", i);
+
+ snprintf(mdt_index, sizeof(mdt_index), "-MDT%04x", i);
rc = mgs_write_log_osc_to_lov(env, mgs, fsdb, mti,
logname, mdt_index,
lovname, LUSTRE_SP_MDT,
int rc, del;
/* Erase any old settings of this same parameter */
- memcpy(comment, ptr, MTI_NAME_MAXLEN);
- comment[MTI_NAME_MAXLEN - 1] = 0;
+ strlcpy(comment, ptr, sizeof(comment));
/* But don't try to match the value. */
tmp = strchr(comment, '=');
if (tmp != NULL)
return -ENOMEM;
lcfg = &lcr->lcr_cfg;
- lcfg->lcfg_num = convert ? simple_strtoul(tmp, NULL, 0) : 0;
+ if (convert) {
+ rc = kstrtouint(tmp, 0, &lcfg->lcfg_num);
+ if (rc)
+ GOTO(out_rec_free, rc);
+ } else {
+ lcfg->lcfg_num = 0;
+ }
+
/* truncate the comment to the parameter name */
ptr = tmp - 1;
sep = *ptr;
}
}
*ptr = sep;
+out_rec_free:
lustre_cfg_rec_free(lcr);
return rc;
}
if (class_match_param(ptr, PARAM_NETWORK, NULL) == 0)
GOTO(end, rc);
- /* Processed in mgs_write_log_ost */
- if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) {
- if (mti->mti_flags & LDD_F_PARAM) {
- LCONSOLE_ERROR_MSG(0x169, "%s can only be "
- "changed with tunefs.lustre"
- "and --writeconf\n", ptr);
- rc = -EPERM;
- }
- GOTO(end, rc);
- }
+ /* Processed in mgs_write_log_ost */
+ if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) {
+ if (mti->mti_flags & LDD_F_PARAM) {
+ LCONSOLE_ERROR_MSG(0x169,
+ "%s can only be changed with tunefs.lustre and --writeconf\n",
+ ptr);
+ rc = -EPERM;
+ }
+ GOTO(end, rc);
+ }
if (class_match_param(ptr, PARAM_SRPC, NULL) == 0) {
rc = mgs_srpc_set_param(env, mgs, fsdb, mti, ptr);
}
active_err:
if (rc < 0) {
- LCONSOLE_ERROR_MSG(0x145, "Couldn't find %s in"
- "log (%d). No permanent "
- "changes were made to the "
- "config log.\n",
+ LCONSOLE_ERROR_MSG(0x145,
+ "Couldn't find %s in log (%d). No permanent changes were made to the config log.\n",
mti->mti_svname, rc);
if (test_bit(FSDB_OLDLOG14, &fsdb->fsdb_flags))
- LCONSOLE_ERROR_MSG(0x146, "This may be"
- " because the log"
- "is in the old 1.4"
- "style. Consider "
- " --writeconf to "
- "update the logs.\n");
+ LCONSOLE_ERROR_MSG(0x146,
+ "This may be because the log is in the old 1.4 style. Consider --writeconf to update the logs.\n");
GOTO(end, rc);
}
/* Fall through to osc/mdc proc for deactivating live
mutex_lock(&fsdb->fsdb_mutex);
- if (mti->mti_flags &
- (LDD_F_VIRGIN | LDD_F_UPGRADE14 | LDD_F_WRITECONF)) {
- /* Generate a log from scratch */
- if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
+ if (mti->mti_flags & (LDD_F_VIRGIN | LDD_F_WRITECONF)) {
+ /* Generate a log from scratch */
+ if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
rc = mgs_write_log_mdt(env, mgs, fsdb, mti);
- } else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
+ } else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
rc = mgs_write_log_ost(env, mgs, fsdb, mti);
- } else {
- CERROR("Unknown target type %#x, can't create log for "
- "%s\n", mti->mti_flags, mti->mti_svname);
- }
- if (rc) {
- CERROR("Can't write logs for %s (%d)\n",
- mti->mti_svname, rc);
- GOTO(out_up, rc);
- }
- } else {
- /* Just update the params from tunefs in mgs_write_log_params */
- CDEBUG(D_MGS, "Update params for %s\n", mti->mti_svname);
- mti->mti_flags |= LDD_F_PARAM;
- }
+ } else {
+ CERROR("Unknown target type %#x, can't create log for %s\n",
+ mti->mti_flags, mti->mti_svname);
+ }
+ if (rc) {
+ CERROR("Can't write logs for %s (%d)\n",
+ mti->mti_svname, rc);
+ GOTO(out_up, rc);
+ }
+ } else {
+ /* Just update the params from tunefs in mgs_write_log_params */
+ CDEBUG(D_MGS, "Update params for %s\n", mti->mti_svname);
+ mti->mti_flags |= LDD_F_PARAM;
+ }
/* allocate temporary buffer, where class_get_next_param will
make copy of a current parameter */
{
struct list_head log_list;
struct mgs_direntry *dirent, *n;
- char *out, *suffix;
- int l, remains, rc;
+ char *out, *suffix, prefix[] = "config_log: ";
+ int prefix_len = strlen(prefix);
+ int l, remains, start = 0, rc;
ENTRY;
out = data->ioc_bulk;
remains = data->ioc_inllen1;
+ /* OBD_FAIL: fetch the config_log records from the specified one */
+ if (OBD_FAIL_CHECK(OBD_FAIL_CATLIST))
+ data->ioc_count = cfs_fail_val;
+
list_for_each_entry_safe(dirent, n, &log_list, mde_list) {
list_del_init(&dirent->mde_list);
suffix = strrchr(dirent->mde_name, '-');
if (suffix != NULL) {
- l = snprintf(out, remains, "config_log: %s\n",
- dirent->mde_name);
+ l = prefix_len + dirent->mde_len + 1;
+ if (remains - 1 < 0) {
+ /* No enough space for this record */
+ mgs_direntry_free(dirent);
+ goto out;
+ }
+ start++;
+ if (start < data->ioc_count) {
+ mgs_direntry_free(dirent);
+ continue;
+ }
+ l = scnprintf(out, remains, "%s%s\n", prefix,
+ dirent->mde_name);
out += l;
remains -= l;
}
mgs_direntry_free(dirent);
- if (remains <= 0)
- break;
+ if (remains == 0)
+ /* Full */
+ goto out;
}
+ /* Finished */
+ start = 0;
+out:
+ data->ioc_count = start;
RETURN(rc);
}
} /* else case fall through */
} /* else case fall through */
}
+ /* fallthrough */
default: {
for (i = 1; i < cnt; i++) {
o_buflen = o_lcfg->lcfg_buflens[i];
ENTRY;
- dev = container_of0(obj->do_lu.lo_dev, struct dt_device, dd_lu_dev);
+ dev = container_of(obj->do_lu.lo_dev, struct dt_device, dd_lu_dev);
th = dt_trans_create(env, dev);
if (IS_ERR(th))
RETURN(PTR_ERR(th));
sizeof(mti->mti_params))
GOTO(out, rc = -E2BIG);
- /* obdname2fsname reports devname as an obd device */
len = strcspn(param, ".=");
if (len && param[len] != '=') {
+ struct list_head *tmp;
char *ptr;
param += len + 1;
snprintf(mti->mti_svname, sizeof(mti->mti_svname), "%.*s",
(int)len, param);
- obdname2fsname(mti->mti_svname, mti->mti_fsname,
- sizeof(mti->mti_fsname));
+ mutex_lock(&mgs->mgs_mutex);
+ if (unlikely(list_empty(&mgs->mgs_fs_db_list))) {
+ mutex_unlock(&mgs->mgs_mutex);
+ GOTO(out, rc = -ENODEV);
+ }
+
+ list_for_each(tmp, &mgs->mgs_fs_db_list) {
+ fsdb = list_entry(tmp, struct fs_db, fsdb_list);
+ if (fsdb->fsdb_has_lproc_entry &&
+ strcmp(fsdb->fsdb_name, "params") != 0 &&
+ strstr(param, fsdb->fsdb_name)) {
+ snprintf(mti->mti_svname,
+ sizeof(mti->mti_svname), "%s",
+ fsdb->fsdb_name);
+ break;
+ }
+ fsdb = NULL;
+ }
+
+ if (!fsdb) {
+ snprintf(mti->mti_svname, sizeof(mti->mti_svname),
+ "general");
+ }
+ mutex_unlock(&mgs->mgs_mutex);
} else {
snprintf(mti->mti_svname, sizeof(mti->mti_svname), "general");
}
enum lcfg_command_type cmd, const char *nodemap_name,
char *param)
{
- lnet_nid_t nid[2];
- __u32 idmap[2];
- bool bool_switch;
- __u32 int_id;
- int rc = 0;
- ENTRY;
+ lnet_nid_t nid[2];
+ u32 idmap[2];
+ bool bool_switch;
+ u32 int_id;
+ int rc = 0;
+ ENTRY;
switch (cmd) {
case LCFG_NODEMAP_ADD:
rc = nodemap_add(nodemap_name);
rc = nodemap_del_range(nodemap_name, nid);
break;
case LCFG_NODEMAP_ADMIN:
- bool_switch = simple_strtoul(param, NULL, 10);
+ rc = kstrtobool(param, &bool_switch);
+ if (rc)
+ break;
rc = nodemap_set_allow_root(nodemap_name, bool_switch);
break;
case LCFG_NODEMAP_DENY_UNKNOWN:
- bool_switch = simple_strtoul(param, NULL, 10);
+ rc = kstrtobool(param, &bool_switch);
+ if (rc)
+ break;
rc = nodemap_set_deny_unknown(nodemap_name, bool_switch);
break;
case LCFG_NODEMAP_AUDIT_MODE:
- rc = kstrtoul(param, 10, (unsigned long *)&bool_switch);
+ rc = kstrtobool(param, &bool_switch);
if (rc == 0)
rc = nodemap_set_audit_mode(nodemap_name, bool_switch);
break;
+ case LCFG_NODEMAP_FORBID_ENCRYPT:
+ rc = kstrtobool(param, &bool_switch);
+ if (rc == 0)
+ rc = nodemap_set_forbid_encryption(nodemap_name,
+ bool_switch);
+ break;
case LCFG_NODEMAP_MAP_MODE:
if (strcmp("both", param) == 0)
rc = nodemap_set_mapping_mode(nodemap_name,
rc = -EINVAL;
break;
case LCFG_NODEMAP_TRUSTED:
- bool_switch = simple_strtoul(param, NULL, 10);
+ rc = kstrtobool(param, &bool_switch);
+ if (rc)
+ break;
rc = nodemap_set_trust_client_ids(nodemap_name, bool_switch);
break;
case LCFG_NODEMAP_SQUASH_UID:
- int_id = simple_strtoul(param, NULL, 10);
+ rc = kstrtouint(param, 10, &int_id);
+ if (rc)
+ break;
rc = nodemap_set_squash_uid(nodemap_name, int_id);
break;
case LCFG_NODEMAP_SQUASH_GID:
- int_id = simple_strtoul(param, NULL, 10);
+ rc = kstrtouint(param, 10, &int_id);
+ if (rc)
+ break;
rc = nodemap_set_squash_gid(nodemap_name, int_id);
break;
case LCFG_NODEMAP_ADD_UIDMAP:
case LCFG_NODEMAP_SET_FILESET:
rc = nodemap_set_fileset(nodemap_name, param);
break;
+ case LCFG_NODEMAP_SET_SEPOL:
+ rc = nodemap_set_sepol(nodemap_name, param);
+ break;
default:
rc = -EINVAL;
}