/* obd methods */
#define MAX_STRING_SIZE 128
static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
- int activate, unsigned long connect_flags)
+ int activate, struct obd_connect_data *conn_data,
+ unsigned long connect_flags)
{
struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
struct obd_uuid *tgt_uuid = &tgt->uuid;
RETURN(0);
}
- rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, connect_flags);
+ rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, conn_data,
+ connect_flags);
if (rc) {
CERROR("Target %s connect error %d\n", tgt_uuid->uuid, rc);
RETURN(rc);
}
static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid, unsigned long flags)
+ struct obd_uuid *cluuid, struct obd_connect_data *data,
+ unsigned long flags)
{
#ifdef __KERNEL__
struct proc_dir_entry *lov_proc_dir;
for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
if (obd_uuid_empty(&tgt->uuid))
continue;
- rc = lov_connect_obd(obd, tgt, 0, flags);
+ rc = lov_connect_obd(obd, tgt, 0, data, flags);
if (rc)
GOTO(out_disc, rc);
}
CDEBUG(D_INFO, "lov idx %d is %s conn "LPX64"\n",
i, tgt->uuid.uuid, tgt->ltd_exp->exp_handle.h_cookie);
- if (strncmp(uuid->uuid, tgt->uuid.uuid, sizeof uuid->uuid) == 0)
+
+ if (obd_uuid_equals(uuid, &tgt->uuid))
break;
}
int count;
ENTRY;
- if (lcfg->lcfg_inllen1 < 1) {
+ if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("LOV setup requires a descriptor\n");
RETURN(-EINVAL);
}
- desc = (struct lov_desc *)lcfg->lcfg_inlbuf1;
- if (sizeof(*desc) > lcfg->lcfg_inllen1) {
+ desc = (struct lov_desc *)lustre_cfg_string(lcfg, 1);
+ if (sizeof(*desc) > LUSTRE_CFG_BUFLEN(lcfg, 1)) {
CERROR("descriptor size wrong: %d > %d\n",
- (int)sizeof(*desc), lcfg->lcfg_inllen1);
+ (int)sizeof(*desc), LUSTRE_CFG_BUFLEN(lcfg, 1));
RETURN(-EINVAL);
}
osc_obd->obd_no_recov = 0;
}
- rc = lov_connect_obd(obd, tgt, 1, lov->lov_connect_flags);
+ rc = lov_connect_obd(obd, tgt, 1, NULL, lov->lov_connect_flags);
if (rc)
GOTO(out, rc);
RETURN(-EINVAL);
}
- if (strncmp(uuidp->uuid, tgt->uuid.uuid, sizeof uuidp->uuid) != 0) {
+ if (!obd_uuid_equals(uuidp, &tgt->uuid)) {
CERROR("LOV target UUID %s at index %d doesn't match %s.\n",
tgt->uuid.uuid, index, uuidp->uuid);
RETURN(-EINVAL);
switch(cmd = lcfg->lcfg_command) {
case LCFG_LOV_ADD_OBD:
case LCFG_LOV_DEL_OBD: {
- if (lcfg->lcfg_inllen1 > sizeof(obd_uuid.uuid))
+ if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(obd_uuid.uuid))
GOTO(out, rc = -EINVAL);
- obd_str2uuid(&obd_uuid, lcfg->lcfg_inlbuf1);
+ obd_str2uuid(&obd_uuid, lustre_cfg_string(lcfg, 1));
- if (sscanf(lcfg->lcfg_inlbuf2, "%d", &index) != 1)
+ if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1)
GOTO(out, rc = -EINVAL);
- if (sscanf(lcfg->lcfg_inlbuf3, "%d", &gen) != 1)
+ if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1)
GOTO(out, rc = -EINVAL);
if (cmd == LCFG_LOV_ADD_OBD)
rc = lov_add_obd(obd, &obd_uuid, index, gen);
#define log2(n) ffz(~(n))
#endif
-static int lov_clear_orphans(struct obd_export *export, struct obdo *src_oa,
+static int lov_clear_orphans(struct obd_export *export,
+ struct obdo *src_oa,
struct lov_stripe_md **ea,
struct obd_trans_info *oti)
{
}
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
+ int err;
struct lov_stripe_md obj_md;
struct lov_stripe_md *obj_mdp = &obj_md;
- int err;
- /* if called for a specific target, we don't
- care if it is not active. */
+ /*
+ * if called for a specific target, we don't care if it is not
+ * active.
+ */
if (lov->tgts[i].active == 0 && ost_uuid == NULL) {
CDEBUG(D_HA, "lov idx %d inactive\n", i);
continue;
if (ost_uuid && !obd_uuid_equals(ost_uuid, &lov->tgts[i].uuid))
continue;
+ /*
+ * setting up objid OSS objects should be destroyed starting
+ * from it.
+ */
memcpy(tmp_oa, src_oa, sizeof(*tmp_oa));
+ tmp_oa->o_valid |= OBD_MD_FLID;
+ tmp_oa->o_id = oti->oti_objid[i];
/* XXX: LOV STACKING: use real "obj_mdp" sub-data */
- err = obd_create(lov->tgts[i].ltd_exp, tmp_oa, &obj_mdp, oti);
- if (err)
- /* This export will be disabled until it is recovered,
- and then orphan recovery will be completed. */
+ err = obd_create(lov->tgts[i].ltd_exp, tmp_oa, NULL, 0,
+ &obj_mdp, oti);
+ if (err) {
+ /*
+ * this export will be disabled until it is recovered,
+ * and then orphan recovery will be completed.
+ */
CERROR("error in orphan recovery on OST idx %d/%d: "
"rc = %d\n", i, lov->desc.ld_tgt_count, err);
+ }
if (ost_uuid)
break;
RETURN(rc);
}
-static int lov_recreate(struct obd_export *exp, struct obdo *src_oa,
- struct lov_stripe_md **ea, struct obd_trans_info *oti)
-{
- struct lov_stripe_md *obj_mdp, *lsm;
- struct lov_obd *lov = &exp->exp_obd->u.lov;
- unsigned ost_idx;
- int rc, i;
- ENTRY;
-
- LASSERT(src_oa->o_valid & OBD_MD_FLFLAGS &&
- src_oa->o_flags & OBD_FL_RECREATE_OBJS);
-
- OBD_ALLOC(obj_mdp, sizeof(*obj_mdp));
- if (obj_mdp == NULL)
- RETURN(-ENOMEM);
-
- ost_idx = src_oa->o_nlink;
- lsm = *ea;
- if (lsm == NULL)
- GOTO(out, rc = -EINVAL);
- if (ost_idx >= lov->desc.ld_tgt_count)
- GOTO(out, rc = -EINVAL);
-
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (lsm->lsm_oinfo[i].loi_ost_idx == ost_idx) {
- if (lsm->lsm_oinfo[i].loi_id != src_oa->o_id)
- GOTO(out, rc = -EINVAL);
- break;
- }
- }
- if (i == lsm->lsm_stripe_count)
- GOTO(out, rc = -EINVAL);
-
- rc = obd_create(lov->tgts[ost_idx].ltd_exp, src_oa, &obj_mdp, oti);
-out:
- OBD_FREE(obj_mdp, sizeof(*obj_mdp));
- RETURN(rc);
-}
-
/* the LOV expects oa->o_id to be set to the LOV object id */
-static int lov_create(struct obd_export *exp, struct obdo *src_oa,
- struct lov_stripe_md **ea, struct obd_trans_info *oti)
+static int
+lov_create(struct obd_export *exp, struct obdo *src_oa,
+ void *acl, int acl_size, struct lov_stripe_md **ea,
+ struct obd_trans_info *oti)
{
struct lov_request_set *set = NULL;
struct list_head *pos;
if (!lov->desc.ld_active_tgt_count)
RETURN(-EIO);
- /* Recreate a specific object id at the given OST index */
- if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
- (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) {
- rc = lov_recreate(exp, src_oa, ea, oti);
- RETURN(rc);
- }
-
+ LASSERT(oti->oti_flags & OBD_MODE_CROW);
+
+ /* main creation loop */
rc = lov_prep_create_set(exp, ea, src_oa, oti, &set);
if (rc)
RETURN(rc);
list_entry(pos, struct lov_request, rq_link);
/* XXX: LOV STACKING: use real "obj_mdp" sub-data */
- rc = obd_create(lov->tgts[req->rq_idx].ltd_exp,
- req->rq_oa, &req->rq_md, oti);
+ rc = obd_create(lov->tgts[req->rq_idx].ltd_exp,
+ req->rq_oa, NULL, 0, &req->rq_md, oti);
lov_update_create_set(set, req, rc);
}
rc = lov_fini_create_set(set, ea);
if (!exp || !exp->exp_obd)
RETURN(-ENODEV);
- /* for now, we only expect time updates here */
LASSERT(!(src_oa->o_valid & ~(OBD_MD_FLID|OBD_MD_FLTYPE | OBD_MD_FLMODE|
OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME | OBD_MD_FLFLAGS |
- OBD_MD_FLSIZE | OBD_MD_FLGROUP)));
+ OBD_MD_FLSIZE | OBD_MD_FLGROUP |
+ OBD_MD_FLUID | OBD_MD_FLGID)));
LASSERT(!(src_oa->o_valid & OBD_MD_FLGROUP) || src_oa->o_gr > 0);
memcpy(tmp_oa, src_oa, sizeof(*tmp_oa));
/* XXX: LOV STACKING: use real "obj_mdp" sub-data */
osc_exp = lov->tgts[ost_idx].ltd_exp;
- rc = obd_create(osc_exp, tmp_oa, &obj_mdp, oti);
+ rc = obd_create(osc_exp, tmp_oa, NULL, 0, &obj_mdp, oti);
if (rc) {
CERROR("error creating new subobj at idx %d; "
"rc = %d\n", ost_idx, rc);
lov = &exp->exp_obd->u.lov;
if (lsm == NULL) {
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- int err = obd_cancel_unused(lov->tgts[i].ltd_exp, NULL,
- flags, opaque);
+ int err = obd_cancel_unused(lov->tgts[i].ltd_exp,
+ NULL, flags, opaque);
if (!rc)
rc = err;
}
tgtdesc = lov->tgts;
/* the uuid will be empty for deleted OSTs */
for (i = 0; i < count; i++, uuidp++, genp++, tgtdesc++) {
- obd_str2uuid(uuidp, tgtdesc->uuid.uuid);
+ obd_str2uuid(uuidp, (char *)tgtdesc->uuid.uuid);
*genp = tgtdesc->ltd_gen;
}
data->stripe_number);
RETURN(0);
} else if (keylen >= strlen("last_id") && strcmp(key, "last_id") == 0) {
+ __u32 size = sizeof(obd_id);
obd_id *ids = val;
- int rc, size = sizeof(obd_id);
+ int rc = 0;
+
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
if (!lov->tgts[i].active)
continue;
#define KEY_IS(str) \
(keylen == strlen(str) && memcmp(key, str, keylen) == 0)
- if (KEY_IS("next_id")) {
- if (vallen != lov->desc.ld_tgt_count)
- RETURN(-EINVAL);
- for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- /* initialize all OSCs, even inactive ones */
-
- err = obd_set_info(lov->tgts[i].ltd_exp,
- keylen, key, sizeof(obd_id),
- ((obd_id*)val) + i);
- if (!rc)
- rc = err;
- }
- RETURN(rc);
- }
if (KEY_IS("async")) {
struct lov_desc *desc = &lov->desc;
struct lov_tgt_desc *tgts = lov->tgts;
RETURN(rc);
}
- if (KEY_IS("growth_count")) {
- if (vallen != sizeof(int))
- RETURN(-EINVAL);
- } else if (KEY_IS("mds_conn")) {
+ if (KEY_IS("mds_conn")) {
if (vallen != sizeof(__u32))
RETURN(-EINVAL);
} else if (KEY_IS("unlinked") || KEY_IS("unrecovery")) {
spin_unlock(&lov->lov_lock);
RETURN(rc);
+ } else if (KEY_IS("flush_cred")) {
+ struct lov_tgt_desc *tgt;
+ int rc = 0, i;
+
+ for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count;
+ i++, tgt++) {
+ if (!tgt->ltd_exp)
+ continue;
+ rc = obd_set_info(tgt->ltd_exp,
+ keylen, key, vallen, val);
+ if (rc)
+ RETURN(rc);
+ }
+
+ RETURN(0);
} else {
RETURN(-EINVAL);
}