data->ocd_version = LUSTRE_VERSION_CODE;
}
+ rc = mgs_client_add(obd, exp, localdata);
+
if (rc) {
class_disconnect(exp);
} else {
static int mgs_reconnect(const struct lu_env *env,
struct obd_export *exp, struct obd_device *obd,
- struct obd_uuid *cluuid, struct obd_connect_data *data)
+ struct obd_uuid *cluuid, struct obd_connect_data *data,
+ void *localdata)
{
ENTRY;
if (exp == NULL || obd == NULL || cluuid == NULL)
RETURN(-EINVAL);
+ mgs_counter_incr(exp, LPROC_MGS_CONNECT);
+
if (data != NULL) {
data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
exp->exp_connect_flags = data->ocd_connect_flags;
LDLM_PLAIN, NULL, LCK_EX,
&flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL,
- fsname, 0, NULL, lockh);
+ fsname, 0, NULL, NULL, lockh);
if (rc)
CERROR("can't take cfg lock for %s (%d)\n", fsname, rc);
rc = mgs_check_index(obd, mti);
if (rc == 0) {
LCONSOLE_ERROR_MSG(0x13b, "%s claims to have registered, but "
- "this MGS does not know about it. Assuming"
- " writeconf.\n", mti->mti_svname);
- mti->mti_flags |= LDD_F_WRITECONF;
- rc = 1;
+ "this MGS does not know about it, preventing "
+ "registration.\n", mti->mti_svname);
+ rc = -ENOENT;
} else if (rc == -1) {
LCONSOLE_ERROR_MSG(0x13c, "Client log %s-client has "
"disappeared! Regenerating all logs.\n",
}
mti->mti_flags |= LDD_F_UPDATE;
/* Erased logs means start from scratch. */
- mti->mti_flags &= ~LDD_F_UPGRADE14;
+ mti->mti_flags &= ~LDD_F_UPGRADE14;
}
/* COMPAT_146 */
CERROR("Can't upgrade from 1.4 (%d)\n", rc);
GOTO(out, rc);
}
-
+
/* We're good to go */
mti->mti_flags |= LDD_F_UPDATE;
}
ENTRY;
target_destroy_export(exp);
+ mgs_client_free(exp);
ldlm_destroy_export(exp);
RETURN(0);
RETURN(0);
}
-static int mgs_iocontrol_pool(struct obd_device *obd,
+static int mgs_iocontrol_pool(struct obd_device *obd,
struct obd_ioctl_data *data)
{
int rc;
if (fsname == NULL)
RETURN(-ENOMEM);
- OBD_ALLOC(poolname, MAXPOOLNAME + 1);
+ OBD_ALLOC(poolname, LOV_MAXPOOLNAME + 1);
if (poolname == NULL) {
rc = -ENOMEM;
GOTO(out_pool, rc);
}
OBD_ALLOC(lcfg, data->ioc_plen1);
- if (lcfg == NULL) {
- rc = -ENOMEM;
- GOTO(out_pool, rc);
- }
- rc = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1);
- if (rc)
- GOTO(out_pool, rc);
+ if (lcfg == NULL)
+ GOTO(out_pool, rc = -ENOMEM);
+
+ if (copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1))
+ GOTO(out_pool, rc = -EFAULT);
if (lcfg->lcfg_bufcount < 2) {
- rc = -EINVAL;
- GOTO(out_pool, rc);
+ GOTO(out_pool, rc = -EFAULT);
}
/* first arg is always <fsname>.<poolname> */
OBD_FREE(fsname, MTI_NAME_MAXLEN);
if (poolname != NULL)
- OBD_FREE(poolname, MAXPOOLNAME + 1);
+ OBD_FREE(poolname, LOV_MAXPOOLNAME + 1);
RETURN(rc);
}
OBD_ALLOC(lcfg, data->ioc_plen1);
if (lcfg == NULL)
RETURN(-ENOMEM);
- rc = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1);
- if (rc)
- GOTO(out_free, rc);
+ if (copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1))
+ GOTO(out_free, rc = -EFAULT);
if (lcfg->lcfg_bufcount < 1)
GOTO(out_free, rc = -EINVAL);