if (!rc) {
LASSERT(cp != NULL);
- rc = ldlm_cli_enqueue_local(mgs->mgs_obd->obd_namespace,
+ rc = ldlm_cli_enqueue_local(NULL, mgs->mgs_obd->obd_namespace,
&res_id, LDLM_PLAIN, NULL, LCK_EX,
&flags, ldlm_blocking_ast, cp,
NULL, fsdb, 0, LVB_T_NONE, NULL,
/* Ensure this is not a failover node that is connecting first*/
static int mgs_check_failover_reg(struct mgs_target_info *mti)
{
- lnet_nid_t nid;
- char *ptr;
- int i;
+ lnet_nid_t nid;
+ char *ptr;
+ int i;
- ptr = mti->mti_params;
- while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
+ ptr = mti->mti_params;
+ while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
- for (i = 0; i < mti->mti_nid_count; i++) {
- if (nid == mti->mti_nids[i]) {
- LCONSOLE_WARN("Denying initial registra"
- "tion attempt from nid %s"
- ", specified as failover"
- "\n",libcfs_nid2str(nid));
- return -EADDRNOTAVAIL;
- }
- }
- }
- }
- return 0;
+ for (i = 0; i < mti->mti_nid_count; i++) {
+ if (nid == mti->mti_nids[i]) {
+ LCONSOLE_WARN("Denying initial registration attempt from nid %s, specified as failover\n",
+ libcfs_nid2str(nid));
+ return -EADDRNOTAVAIL;
+ }
+ }
+ }
+ }
+ return 0;
}
/* Called whenever a target starts up. Flags indicate first connect, etc. */
if (mti->mti_flags & LDD_F_NEED_INDEX)
mti->mti_flags |= LDD_F_WRITECONF;
- if (!(mti->mti_flags & (LDD_F_WRITECONF | LDD_F_UPGRADE14 |
- LDD_F_UPDATE))) {
+ if (!(mti->mti_flags & (LDD_F_WRITECONF | LDD_F_UPDATE))) {
/* We're just here as a startup ping. */
CDEBUG(D_MGS, "Server %s is running on %s\n",
mti->mti_svname, obd_export_nid2str(tsi->tsi_exp));
}
mti->mti_flags |= LDD_F_UPDATE;
- /* Erased logs means start from scratch. */
- mti->mti_flags &= ~LDD_F_UPGRADE14;
}
rc = mgs_find_or_make_fsdb(tsi->tsi_env, mgs, mti->mti_fsname, &c_fsdb);
GOTO(out_norevoke, rc);
}
- /*
- * Log writing contention is handled by the fsdb_mutex.
- *
- * It should be alright if someone was reading while we were
- * updating the logs - if we revoke at the end they will just update
- * from where they left off.
- */
-
- if (mti->mti_flags & LDD_F_UPGRADE14) {
- CERROR("Can't upgrade from 1.4 (%d)\n", rc);
- GOTO(out, rc);
- }
-
+ /*
+ * Log writing contention is handled by the fsdb_mutex.
+ *
+ * It should be alright if someone was reading while we were
+ * updating the logs - if we revoke at the end they will just update
+ * from where they left off.
+ */
if (mti->mti_flags & LDD_F_UPDATE) {
CDEBUG(D_MGS, "updating %s, index=%d\n", mti->mti_svname,
mti->mti_stripe_index);
GOTO(out, rc);
}
- mti->mti_flags &= ~(LDD_F_VIRGIN | LDD_F_UPDATE |
- LDD_F_NEED_INDEX | LDD_F_WRITECONF |
- LDD_F_UPGRADE14);
- mti->mti_flags |= LDD_F_REWRITE_LDD;
+ mti->mti_flags &= ~(LDD_F_VIRGIN | LDD_F_UPDATE |
+ LDD_F_NEED_INDEX | LDD_F_WRITECONF);
+ mti->mti_flags |= LDD_F_REWRITE_LDD;
}
out:
/* Also make sure poolname is not to long. */
if (strlen(ptr) > LOV_MAXPOOLNAME)
return -ENAMETOOLONG;
- strncpy(poolname, ptr, strlen(ptr));
+ strncpy(poolname, ptr, LOV_MAXPOOLNAME);
/* Test if fsname is empty */
len = strlen(arg) - strlen(ptr) - 1;
nid = libcfs_str2nid(nidstr);
nodemap_test_nid(nid, name_buf, sizeof(name_buf));
rc = copy_to_user(data->ioc_pbuf1, name_buf,
- MIN(data->ioc_plen1, sizeof(name_buf)));
+ min_t(size_t, data->ioc_plen1,
+ sizeof(name_buf)));
if (rc != 0)
GOTO(out_lcfg, rc = -EFAULT);
break;
case LCFG_NODEMAP_ADD_GIDMAP:
case LCFG_NODEMAP_DEL_GIDMAP:
case LCFG_NODEMAP_SET_FILESET:
+ case LCFG_NODEMAP_SET_SEPOL:
if (lcfg->lcfg_bufcount != 3)
GOTO(out_lcfg, rc = -EINVAL);
nodemap_name = lustre_cfg_string(lcfg, 1);
case LCFG_NODEMAP_SQUASH_UID:
case LCFG_NODEMAP_SQUASH_GID:
case LCFG_NODEMAP_MAP_MODE:
+ case LCFG_NODEMAP_AUDIT_MODE:
if (lcfg->lcfg_bufcount != 4)
GOTO(out_lcfg, rc = -EINVAL);
nodemap_name = lustre_cfg_string(lcfg, 1);
case OBD_IOC_REPLACE_NIDS: {
if (!data->ioc_inllen1 || !data->ioc_inlbuf1) {
- CERROR("No device name specified!\n");
rc = -EINVAL;
+ CERROR("%s: no device or fsname specified: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
break;
}
- if (data->ioc_inlbuf1[data->ioc_inllen1 - 1] != 0) {
- CERROR("Device name is not NUL terminated!\n");
- rc = -EINVAL;
+ if (data->ioc_inllen1 > MTI_NAME_MAXLEN) {
+ rc = -EOVERFLOW;
+ CERROR("%s: device or fsname is too long: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
break;
}
- if (data->ioc_plen1 > MTI_NAME_MAXLEN) {
- CERROR("Device name is too long\n");
- rc = -EOVERFLOW;
+ if (data->ioc_inlbuf1[data->ioc_inllen1 - 1] != 0) {
+ rc = -EINVAL;
+ CERROR("%s: device or fsname is not NUL terminated: "
+ "rc = %d\n", exp->exp_obd->obd_name, rc);
break;
}
if (!data->ioc_inllen2 || !data->ioc_inlbuf2) {
- CERROR("No NIDs were specified!\n");
rc = -EINVAL;
+ CERROR("%s: no NIDs specified: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
break;
}
if (data->ioc_inlbuf2[data->ioc_inllen2 - 1] != 0) {
- CERROR("NID list is not NUL terminated!\n");
rc = -EINVAL;
+ CERROR("%s: NID list is not NUL terminated: "
+ "rc = %d\n", exp->exp_obd->obd_name, rc);
break;
}
break;
}
+ case OBD_IOC_CLEAR_CONFIGS: {
+ if (!data->ioc_inllen1 || !data->ioc_inlbuf1) {
+ rc = -EINVAL;
+ CERROR("%s: no device or fsname specified: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
+ break;
+ }
+
+ if (data->ioc_inllen1 > MTI_NAME_MAXLEN) {
+ rc = -EOVERFLOW;
+ CERROR("%s: device or fsname is too long: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
+ break;
+ }
+
+ if (data->ioc_inlbuf1[data->ioc_inllen1 - 1] != 0) {
+ rc = -EINVAL;
+ CERROR("%s: device or fsname is not NUL terminated: "
+ "rc = %d\n", exp->exp_obd->obd_name, rc);
+ break;
+ }
+
+ /* remove records marked SKIP from config logs */
+ rc = mgs_clear_configs(&env, mgs, data->ioc_inlbuf1);
+ if (rc)
+ CERROR("%s: error clearing config log: rc = %d\n",
+ exp->exp_obd->obd_name, rc);
+
+ break;
+ }
+
case OBD_IOC_POOL:
rc = mgs_iocontrol_pool(&env, mgs, data);
break;
&RQF_MDS_DISCONNECT, LUSTRE_OBD_VERSION),
TGT_MGS_HDL_VAR(0, MGS_EXCEPTION, mgs_exception),
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0)
-TGT_MGS_HDL (HABEO_REFERO | MUTABOR, MGS_SET_INFO, mgs_set_info),
+TGT_MGS_HDL(HAS_REPLY | IS_MUTABLE, MGS_SET_INFO, mgs_set_info),
#endif
-TGT_MGS_HDL (HABEO_REFERO | MUTABOR, MGS_TARGET_REG, mgs_target_reg),
+TGT_MGS_HDL(HAS_REPLY | IS_MUTABLE, MGS_TARGET_REG, mgs_target_reg),
TGT_MGS_HDL_VAR(0, MGS_TARGET_DEL, mgs_target_del),
-TGT_MGS_HDL (HABEO_REFERO, MGS_CONFIG_READ, mgs_config_read),
+TGT_MGS_HDL(HAS_REPLY, MGS_CONFIG_READ, mgs_config_read),
};
static struct tgt_handler mgs_obd_handlers[] = {
* * instead of common OBD_FAIL_LDLM_ENQUEUE_NET */
.th_fail_id = 0,
.th_opc = LDLM_ENQUEUE,
- .th_flags = HABEO_CLAVIS,
+ .th_flags = HAS_KEY,
.th_act = tgt_enqueue,
.th_fmt = &RQF_LDLM_ENQUEUE,
.th_version = LUSTRE_DLM_VERSION,
TGT_LLOG_HDL (0, LLOG_ORIGIN_HANDLE_CREATE, mgs_llog_open),
TGT_LLOG_HDL (0, LLOG_ORIGIN_HANDLE_NEXT_BLOCK, tgt_llog_next_block),
TGT_LLOG_HDL (0, LLOG_ORIGIN_HANDLE_READ_HEADER, tgt_llog_read_header),
-TGT_LLOG_HDL_VAR(0, LLOG_ORIGIN_HANDLE_CLOSE, tgt_llog_close),
TGT_LLOG_HDL (0, LLOG_ORIGIN_HANDLE_PREV_BLOCK, tgt_llog_prev_block),
};
/* Start the service threads */
mgs->mgs_service = ptlrpc_register_service(&conf, &obd->obd_kset,
- obd->obd_proc_entry);
+ obd->obd_debugfs_entry);
if (IS_ERR(mgs->mgs_service)) {
rc = PTR_ERR(mgs->mgs_service);
CERROR("failed to start mgs service: %d\n", rc);
}
/* use obd ops to offer management infrastructure */
-static struct obd_ops mgs_obd_device_ops = {
+static const struct obd_ops mgs_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = mgs_obd_connect,
.o_reconnect = mgs_obd_reconnect,