From: nathan Date: Fri, 27 Jan 2006 02:10:54 +0000 (+0000) Subject: Branch b_release_1_4_6 X-Git-Tag: v1_7_100~1^103~4^2~74 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=016fe708fd39251c40269b0fab14472590faacfa;p=fs%2Flustre-release.git Branch b_release_1_4_6 b=9860 r=adilger Include ost index from mds connect, so we can set it in the last_rcvd file. This will be useful when upgrading to 1.6 --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index be38e15..e598a20 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -241,7 +241,7 @@ static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags) OBD_CONNECT_IBITS | OBD_CONNECT_JOIN) #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ - OBD_CONNECT_TRUNCLOCK) + OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX) #define ECHO_CONNECT_SUPPORTED (0) #define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\ diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index e6404ba..3ca8b11 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -220,6 +220,8 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) { if (obd_uuid_empty(&tgt->uuid)) continue; + if (connect_flags & OBD_CONNECT_INDEX) + data->ocd_index = i; rc = lov_connect_obd(obd, tgt, 0, data); if (rc) GOTO(out_disc, rc); @@ -1166,7 +1168,7 @@ static int lov_setattr_async(struct obd_export *exp, struct obdo *src_oa, LASSERT(!(src_oa->o_valid & ~(OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID| OBD_MD_FLCOOKIE | - OBD_MD_FLFID | OBD_MD_FLGENER))); + OBD_MD_FLFID | OBD_MD_FLGENER))); lov = &exp->exp_obd->u.lov; loi = lsm->lsm_oinfo; diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index c4279ad..f13893c 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "mds_internal.h" @@ -181,6 +182,7 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) { struct mds_obd *mds = &obd->u.mds; struct lustre_handle conn = {0,}; + struct obd_connect_data *data; int rc, i; ENTRY; @@ -197,8 +199,14 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) RETURN(-ENOTCONN); } - rc = obd_connect(&conn, mds->mds_osc_obd, &obd->obd_uuid, - NULL /* obd_connect_data */); + OBD_ALLOC(data, sizeof(*data)); + if (data == NULL) + RETURN(-ENOMEM); + data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_INDEX; + data->ocd_version = LUSTRE_VERSION_CODE; + /* NB: lov_connect() needs to fill in .ocd_index for each OST */ + rc = obd_connect(&conn, mds->mds_osc_obd, &obd->obd_uuid, data); + OBD_FREE(data, sizeof(*data)); if (rc) { CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc); mds->mds_osc_obd = ERR_PTR(rc); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 6e9ad57..7d265b4 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1714,32 +1714,59 @@ static int filter_cleanup(struct obd_device *obd) static int filter_connect_internal(struct obd_export *exp, struct obd_connect_data *data) { - if (data != NULL) { - CDEBUG(D_RPCTRACE, "%s: cli %s/%p ocd_connect_flags: "LPX64 - " ocd_version: %x ocd_grant: %d\n", - exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, - data->ocd_connect_flags, data->ocd_version, - data->ocd_grant); - - data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; - exp->exp_connect_flags = data->ocd_connect_flags; - data->ocd_version = LUSTRE_VERSION_CODE; - - if (exp->exp_connect_flags & OBD_CONNECT_GRANT) { - obd_size left, want; - - spin_lock(&exp->exp_obd->obd_osfs_lock); - left = filter_grant_space_left(exp); - want = data->ocd_grant; - data->ocd_grant = filter_grant(exp, 0, want, left); - spin_unlock(&exp->exp_obd->obd_osfs_lock); - - CDEBUG(D_CACHE, "%s: cli %s/%p ocd_grant: %d want: " - "%lld left: %lld\n", exp->exp_obd->obd_name, - exp->exp_client_uuid.uuid, exp, - data->ocd_grant, want, left); + if (!data) + RETURN(0); + + CDEBUG(D_RPCTRACE, "%s: cli %s/%p ocd_connect_flags: "LPX64 + " ocd_version: %x ocd_grant: %d\n", + exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, + data->ocd_connect_flags, data->ocd_version, + data->ocd_grant); + + data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; + exp->exp_connect_flags = data->ocd_connect_flags; + data->ocd_version = LUSTRE_VERSION_CODE; + + if (exp->exp_connect_flags & OBD_CONNECT_GRANT) { + obd_size left, want; + + spin_lock(&exp->exp_obd->obd_osfs_lock); + left = filter_grant_space_left(exp); + want = data->ocd_grant; + data->ocd_grant = filter_grant(exp, 0, want, left); + spin_unlock(&exp->exp_obd->obd_osfs_lock); + + CDEBUG(D_CACHE, "%s: cli %s/%p ocd_grant: %d want: " + "%lld left: %lld\n", exp->exp_obd->obd_name, + exp->exp_client_uuid.uuid, exp, + data->ocd_grant, want, left); + } + + if (data->ocd_connect_flags & OBD_CONNECT_INDEX) { + struct filter_obd *filter = &exp->exp_obd->u.filter; + struct filter_server_data *fsd = filter->fo_fsd; + int index = le32_to_cpu(fsd->fsd_ost_index); + + if (!(fsd->fsd_feature_compat & + cpu_to_le32(OBD_COMPAT_OST))) { + /* this will only happen on the first connect */ + fsd->fsd_ost_index = le32_to_cpu(data->ocd_index); + fsd->fsd_feature_compat |= cpu_to_le32(OBD_COMPAT_OST); + filter_update_server_data(exp->exp_obd, + filter->fo_rcvd_filp, fsd, 1); + } else if (index != data->ocd_index) { + LCONSOLE_ERROR("Connection from %s to index " + "%u doesn't match actual OST " + "index %u, bad configuration?\n", + obd_export_nid2str(exp), index, + data->ocd_index); + RETURN(-EBADF); } } + /* FIXME: Do the same with the MDS UUID and fsd_peeruuid. + * FIXME: We don't strictly need the COMPAT flag for that, + * FIXME: as fsd_peeruuid[0] will tell us if that is set. + * FIXME: We needed it for the index, as index 0 is valid. */ RETURN(0); } @@ -1761,7 +1788,8 @@ static int filter_reconnect(struct obd_export *exp, struct obd_device *obd, /* nearly identical to mds_connect */ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, - struct obd_uuid *cluuid, struct obd_connect_data *data) + struct obd_uuid *cluuid, + struct obd_connect_data *data) { struct obd_export *exp; struct filter_export_data *fed;