struct mgs_direntry *de;
char *key;
int rc, key_sz;
- size_t suffix_len = sizeof(".bak") - 1;
INIT_LIST_HEAD(log_list);
goto next;
}
- /* filter out ".bak" files */
- if (key_sz >= suffix_len &&
- !memcmp(".bak", key + key_sz - suffix_len, suffix_len)) {
+ /* 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;
/* 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 mdt_idx)
}
/* 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)
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)
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
{
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);
}
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));
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,