X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Flmv%2Flmv_obd.c;h=9d6aab1e54db96773c72bfdf94354e1eda7ca039;hb=d41530916baeff6b289e5658cc27d79fdd34cb7e;hp=9ed4375300384a7b0f8bb6de4541a70045ca9848;hpb=128352dc778e2a68cc04d7032562285d1dab8262;p=fs%2Flustre-release.git diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 9ed4375..9d6aab1 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -171,7 +171,7 @@ int lmv_detach(struct obd_device *dev) * say caller that everything is okay. Real connection will be performed * later. */ static int lmv_connect(struct lustre_handle *conn, struct obd_device *obd, - struct obd_uuid *cluuid) + struct obd_uuid *cluuid, unsigned long connect_flags) { struct lmv_obd *lmv = &obd->u.lmv; struct obd_export *exp; @@ -194,6 +194,7 @@ static int lmv_connect(struct lustre_handle *conn, struct obd_device *obd, } lmv->cluuid = *cluuid; + lmv->connect_flags = connect_flags; lmv->connected = 0; lmv->exp = exp; @@ -222,7 +223,8 @@ void lmv_set_timeouts(struct obd_device *obd) } /* Performs a check if passed obd is connected. If no - connect it. */ -int lmv_check_connect(struct obd_device *obd) { +int lmv_check_connect(struct obd_device *obd) +{ struct lmv_obd *lmv = &obd->u.lmv; struct obd_uuid *cluuid; struct lmv_tgt_desc *tgts; @@ -271,7 +273,7 @@ int lmv_check_connect(struct obd_device *obd) { GOTO(out_disc, rc = -EINVAL); } - rc = obd_connect(&conn, tgt_obd, &lmv_osc_uuid); + rc = obd_connect(&conn, tgt_obd, &lmv_osc_uuid, lmv->connect_flags); if (rc) { CERROR("Target %s connect error %d\n", tgts->uuid.uuid, rc); @@ -299,7 +301,6 @@ int lmv_check_connect(struct obd_device *obd) { } lmv_set_timeouts(obd); - class_export_put(exp); return 0; @@ -335,8 +336,6 @@ static int lmv_disconnect(struct obd_export *exp, int flags) if (lmv->refcount != 0) goto out_local; - lmv->connected = 0; - for (i = 0; i < lmv->desc.ld_tgt_count; i++) { if (lmv->tgts[i].ltd_exp == NULL) continue; @@ -379,6 +378,8 @@ out_local: if (!lmv->connected) class_export_put(exp); rc = class_disconnect(exp, 0); + if (lmv->refcount == 0) + lmv->connected = 0; RETURN(rc); } @@ -660,7 +661,7 @@ static int lmv_change_cbdata_name(struct obd_export *exp, struct ll_fid *pfid, obj = lmv_grab_obj(obd, pfid); if (obj) { /* directory is splitted. look for right mds for this name. */ - mds = raw_name2idx(obj->objcount, name, len); + mds = raw_name2idx(obj->hashtype, obj->objcount, name, len); mds = obj->objs[mds].fid.mds; lmv_put_obj(obj); } @@ -768,7 +769,7 @@ repeat: LASSERT(++loop <= 2); obj = lmv_grab_obj(obd, &op_data->fid1); if (obj) { - mds = raw_name2idx(obj->objcount, op_data->name, + mds = raw_name2idx(obj->hashtype, obj->objcount, op_data->name, op_data->namelen); op_data->fid1 = obj->objs[mds].fid; lmv_put_obj(obj); @@ -905,8 +906,8 @@ int lmv_enqueue(struct obd_export *exp, int lock_type, if (obj) { /* directory is splitted. look for right mds for this * name */ - mds = raw_name2idx(obj->objcount, (char *)data->name, - data->namelen); + mds = raw_name2idx(obj->hashtype, obj->objcount, + (char *)data->name, data->namelen); data->fid1 = obj->objs[mds].fid; lmv_put_obj(obj); } @@ -940,7 +941,7 @@ repeat: obj = lmv_grab_obj(obd, fid); if (obj) { /* directory is splitted. look for right mds for this name */ - mds = raw_name2idx(obj->objcount, filename, namelen - 1); + mds = raw_name2idx(obj->hashtype, obj->objcount, filename, namelen - 1); rfid = obj->objs[mds].fid; lmv_put_obj(obj); } @@ -1005,7 +1006,7 @@ int lmv_link(struct obd_export *exp, struct mdc_op_data *data, /* usual link request */ obj = lmv_grab_obj(obd, &data->fid1); if (obj) { - rc = raw_name2idx(obj->objcount, data->name, + rc = raw_name2idx(obj->hashtype, obj->objcount, data->name, data->namelen); data->fid1 = obj->objs[rc].fid; lmv_put_obj(obj); @@ -1083,7 +1084,7 @@ int lmv_rename(struct obd_export *exp, struct mdc_op_data *data, if (obj) { /* directory is already splitted, so we have to forward request * to the right MDS */ - mds = raw_name2idx(obj->objcount, (char *)old, oldlen); + mds = raw_name2idx(obj->hashtype, obj->objcount, (char *)old, oldlen); data->fid1 = obj->objs[mds].fid; CDEBUG(D_OTHER, "forward to MDS #%u (%lu/%lu/%lu)\n", mds, (unsigned long)obj->objs[mds].fid.mds, @@ -1096,7 +1097,7 @@ int lmv_rename(struct obd_export *exp, struct mdc_op_data *data, if (obj) { /* directory is already splitted, so we have to forward request * to the right MDS */ - mds = raw_name2idx(obj->objcount, (char *)new, newlen); + mds = raw_name2idx(obj->hashtype, obj->objcount, (char *)new, newlen); data->fid2 = obj->objs[mds].fid; CDEBUG(D_OTHER, "forward to MDS #%u (%lu/%lu/%lu)\n", mds, (unsigned long)obj->objs[mds].fid.mds, @@ -1359,7 +1360,7 @@ int lmv_unlink(struct obd_export *exp, struct mdc_op_data *data, obj = lmv_grab_obj(obd, &data->fid1); if (obj) { - i = raw_name2idx(obj->objcount, data->name, + i = raw_name2idx(obj->hashtype, obj->objcount, data->name, data->namelen); data->fid1 = obj->objs[i].fid; lmv_put_obj(obj); @@ -1499,6 +1500,7 @@ int lmv_obd_create(struct obd_export *exp, struct obdo *oa, mea = (struct mea *)*ea; if (!mea->mea_count || mea->mea_count > lmv->desc.ld_tgt_count) mea->mea_count = lmv->desc.ld_tgt_count; + mea->mea_magic = MEA_MAGIC_ALL_CHARS; mea->mea_master = -1; lcount = lmv->desc.ld_tgt_count; @@ -1600,22 +1602,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, } lmv = &obd->u.lmv; - if (keylen >= strlen("client") && strcmp(key, "client") == 0) { - struct lmv_tgt_desc *tgts; - int i, rc; - - rc = lmv_check_connect(obd); - if (rc) - RETURN(rc); - - for (i = 0, tgts = lmv->tgts; - i < lmv->desc.ld_tgt_count; i++, tgts++) { - rc = obd_set_info(tgts->ltd_exp, keylen, key, vallen, val); - if (rc) - RETURN(rc); - } - RETURN(0); - } else if (keylen >= strlen("inter_mds") && strcmp(key, "inter_mds") == 0) { + if (keylen >= strlen("inter_mds") && strcmp(key, "inter_mds") == 0) { lmv->server_timeout = 1; lmv_set_timeouts(obd); RETURN(0);