From 905a547356dab45f06dd535776bde3fab76c4688 Mon Sep 17 00:00:00 2001 From: jxiong Date: Thu, 7 May 2009 01:09:21 +0000 Subject: [PATCH] b=19264 r=ericm,fanyong Fixed an issue in __mds_lov_synchronize(), where mds_propagate_capa_keys() tried to propagate the capa keys to all OSTs. This is not good because if one of the OST is not ready, it will cause the mds.osc to be set to inactive, and don't have a chane to get over. --- lustre/include/lustre_mds.h | 5 +++++ lustre/lov/lov_obd.c | 20 ++++++++++++++++++-- lustre/mdd/mdd_device.c | 3 ++- lustre/mds/mds_lov.c | 8 +++++--- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lustre/include/lustre_mds.h b/lustre/include/lustre_mds.h index c427feb..1fefb2b 100644 --- a/lustre/include/lustre_mds.h +++ b/lustre/include/lustre_mds.h @@ -65,6 +65,11 @@ struct mds_group_info { int group; }; +struct mds_capa_info { + struct obd_uuid *uuid; + struct lustre_capa_key *capa; +}; + /* mds/mds_lov.c */ int mds_lov_write_objids(struct obd_device *obd); int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index fd6ba09..d7ce626 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2559,7 +2559,7 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen, struct lov_tgt_desc *tgt; unsigned incr, check_uuid, do_inactive, no_set; - unsigned next_id = 0, mds_con = 0; + unsigned next_id = 0, mds_con = 0, capa = 0; ENTRY; incr = check_uuid = do_inactive = no_set = 0; @@ -2587,6 +2587,8 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen, /* use defaults: do_inactive = incr = 0; */ } else if (KEY_IS(KEY_MDS_CONN)) { mds_con = 1; + } else if (KEY_IS(KEY_CAPA_KEY)) { + capa = 1; } for (i = 0; i < count; i++, val = (char *)val + incr) { @@ -2621,7 +2623,21 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen, err = obd_set_info_async(tgt->ltd_exp, keylen, key, vallen, ((struct obd_id_info*)val)->data, set); - } else { + } else if (capa) { + struct mds_capa_info *info = (struct mds_capa_info*)val; + + LASSERT(vallen == sizeof(*info)); + + /* Only want a specific OSC */ + if (info->uuid && + !obd_uuid_equals(info->uuid, &tgt->ltd_uuid)) + continue; + + err = obd_set_info_async(tgt->ltd_exp, keylen, key, + sizeof(*info->capa), + info->capa, set); + + } else { /* Only want a specific OSC */ if (check_uuid && !obd_uuid_equals(val, &tgt->ltd_uuid)) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index d41e652..05bf856 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -1020,13 +1020,14 @@ static int mdd_update_capa_key(const struct lu_env *env, struct md_device *m, struct lustre_capa_key *key) { + struct mds_capa_info info = { .uuid = NULL, .capa = key }; struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); struct obd_export *lov_exp = mdd2obd_dev(mdd)->u.mds.mds_osc_exp; int rc; ENTRY; rc = obd_set_info_async(lov_exp, sizeof(KEY_CAPA_KEY), KEY_CAPA_KEY, - sizeof(*key), key, NULL); + sizeof(info), &info, NULL); RETURN(rc); } diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index afb7564..596d52e 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -716,8 +716,9 @@ struct mds_lov_sync_info { __u32 mlsi_index; /* index of target */ }; -static int mds_propagate_capa_keys(struct mds_obd *mds) +static int mds_propagate_capa_keys(struct mds_obd *mds, struct obd_uuid *uuid) { + struct mds_capa_info info = { .uuid = uuid }; struct lustre_capa_key *key; int i, rc = 0; @@ -730,8 +731,9 @@ static int mds_propagate_capa_keys(struct mds_obd *mds) key = &mds->mds_capa_keys[i]; DEBUG_CAPA_KEY(D_SEC, key, "propagate"); + info.capa = key; rc = obd_set_info_async(mds->mds_osc_exp, sizeof(KEY_CAPA_KEY), - KEY_CAPA_KEY, sizeof(*key), key, NULL); + KEY_CAPA_KEY, sizeof(info), &info, NULL); if (rc) { DEBUG_CAPA_KEY(D_ERROR, key, "propagate failed (rc = %d) for", rc); @@ -785,7 +787,7 @@ static int __mds_lov_synchronize(void *data) if (rc != 0) GOTO(out, rc); /* propagate capability keys */ - rc = mds_propagate_capa_keys(mds); + rc = mds_propagate_capa_keys(mds, uuid); if (rc) GOTO(out, rc); -- 1.8.3.1