From 0049c529dbf1a749f98366cde716e2063a0c63a4 Mon Sep 17 00:00:00 2001 From: niu <niu> Date: Wed, 10 Aug 2005 10:17:59 +0000 Subject: [PATCH] - check connection before calling obd_set_info to set ids on an specified mdc. - typo fix in mds_set_info. --- lustre/lmv/lmv_obd.c | 19 ++++++++++++++++--- lustre/mds/handler.c | 6 +++--- lustre/mds/mds_reint.c | 7 ++----- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index c3119b46dc..6f2e061e0d 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1972,6 +1972,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, struct lmv_tgt_desc *tgt; struct obd_device *obd; struct lmv_obd *lmv; + int rc = 0; ENTRY; obd = class_exp2obd(exp); @@ -1993,7 +1994,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, (keylen == strlen("sec_flags") && strcmp(key, "sec_flags") == 0) || (keylen == strlen("nllu") && strcmp(key, "nllu") == 0)) { struct obd_export *exp; - int rc = 0, err, i; + int err, i; spin_lock(&lmv->lmv_lock); for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; @@ -2029,7 +2030,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, if (keylen == 5 && strcmp(key, "audit") == 0) { struct audit_attr_msg * msg = val; int mds = id_group(&msg->id); - int i, rc = 0; + int i; LASSERT(mds < lmv->desc.ld_tgt_count); if (IS_AUDIT_OP(msg->attr, AUDIT_FS)) { @@ -2075,7 +2076,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, strcmp(key, "flush_cred") == 0)) || ((keylen == strlen("crypto_type") && strcmp(key, "crypto_type") == 0))) { - int rc = 0, i; + int i; for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgt++) { @@ -2089,6 +2090,18 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen, RETURN(0); } + + if (keylen == strlen("ids") && memcmp(key, "ids", keylen) == 0) { + struct lustre_id *id = (struct lustre_id *)val; + + rc = lmv_check_connect(obd); + if (rc) + RETURN(rc); + + rc = obd_set_info(lmv->tgts[id_group(id)].ltd_exp, + keylen, key, vallen, val); + RETURN(rc); + } RETURN(-EINVAL); } diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 756d6719db..985f5a16a9 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2728,7 +2728,7 @@ static int mds_set_info(struct obd_export *exp, __u32 keylen, de = mds_id2dentry(obd, ids, NULL); if (IS_ERR(de)) { rc = PTR_ERR(de); - CERROR("lookup by an id error %d\n", rc); + CERROR("lookup by an id error rc=%d\n ", rc); RETURN(rc); } inode = de->d_inode; @@ -2839,10 +2839,10 @@ static int mdt_set_info(struct ptlrpc_request *req) RETURN(rc); id = lustre_swab_reqbuf(req, 1, sizeof(struct lustre_id), lustre_swab_lustre_id); - ids[1] = *id; + ids[0] = *id; id = lustre_swab_reqbuf(req, 2, sizeof(struct lustre_id), lustre_swab_lustre_id); - ids[2] = *id; + ids[1] = *id; rc = obd_set_info(exp, keylen, key, vallen, ids); req->rq_repmsg->status = rc; diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 6e6068d3b8..f84077b4bd 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -3319,8 +3319,7 @@ static int mds_reint_rename_create_name(struct mds_update_record *rec, GOTO(cleanup, rc); ids[0] = *(rec->ur_id1); - rc = obd_set_info(mds->mds_md_obd->u.lmv.tgts[id_group(rec->ur_id1)].ltd_exp, - strlen("ids"), "ids", + rc = obd_set_info(mds->mds_md_exp, strlen("ids"), "ids", sizeof(struct lustre_id) * 2, ids); EXIT; @@ -3610,8 +3609,6 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset, if (de_old->d_flags & DCACHE_CROSS_REF) { struct lustre_id old_id; - struct obd_export *tgt_exp = - mds->mds_md_obd->u.lmv.tgts[de_old->d_mdsnum].ltd_exp; mds_pack_dentry2id(obd, &old_id, de_old, 1); @@ -3627,7 +3624,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset, GOTO(cleanup, rc); ids[0] = old_id; - rc = obd_set_info(tgt_exp, strlen("ids"), "ids", + rc = obd_set_info(mds->mds_md_exp, strlen("ids"), "ids", sizeof(struct lustre_id) * 2, ids); GOTO(cleanup, rc); -- GitLab