From: Mr NeilBrown Date: Wed, 12 Apr 2023 12:58:01 +0000 (-0400) Subject: LU-10391 lustre: obd_connect and reconnect now use large nid X-Git-Tag: 2.15.56~125 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3b2926161d27906642a747f3449006267fecba18;p=fs%2Flustre-release.git LU-10391 lustre: obd_connect and reconnect now use large nid The 'localdata' argument for o_connect and o_reconnect when called server-side is now a 'struct lnet_nid *' rather than an 'lnet_nid_t *'. Signed-off-by: Mr NeilBrown Change-Id: I1ce72ec11a5d2463fb90ab2686410e2dd96118e2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50097 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 1017c91..1961ddb 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1078,7 +1078,10 @@ struct obd_ops { /* connect to the target device with given connection * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags - * asked for. If @ocd == NULL, use default parameters. */ + * asked for. If @ocd == NULL, use default parameters. + * On the client, localdata is a struct cl_client_cache *. + * On the server, localdata is a struct lnet_nid *. + */ int (*o_connect)(const struct lu_env *env, struct obd_export **exp, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *ocd, diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 2ef3add..71fd089 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1089,7 +1089,6 @@ int target_handle_connect(struct ptlrpc_request *req) bool new_mds_mds_conn = false; struct obd_connect_data *data, *tmpdata; int size, tmpsize; - lnet_nid_t client_nid; #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) int tmp_exp_old_falloc; #endif @@ -1391,7 +1390,6 @@ no_export: /* Tell the client if we support replayable requests. */ if (target->obd_replayable) lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_REPLAYABLE); - client_nid = lnet_nid_to_nid4(&req->rq_peer.nid); if (export == NULL) { /* allow lightweight connections during recovery */ @@ -1437,7 +1435,7 @@ no_export: dont_check_exports: rc = obd_connect(req->rq_svc_thread->t_env, &export, target, &cluuid, data, - &client_nid); + &req->rq_peer.nid); if (mds_conn && OBD_FAIL_CHECK(OBD_FAIL_TGT_RCVG_FLAG)) lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_RECOVERING); @@ -1456,7 +1454,8 @@ dont_check_exports: class_export_put(export); } rc = obd_reconnect(req->rq_svc_thread->t_env, - export, target, &cluuid, data, &client_nid); + export, target, &cluuid, data, + &req->rq_peer.nid); if (rc == 0) reconnected = true; } diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c index a1c9011..2335524 100644 --- a/lustre/mdt/mdt_fs.c +++ b/lustre/mdt/mdt_fs.c @@ -63,18 +63,13 @@ static const struct proc_ops mdt_open_files_seq_fops = { int mdt_export_stats_init(struct obd_device *obd, struct obd_export *exp, void *localdata) { - lnet_nid_t *client_nid4 = localdata; + struct lnet_nid *client_nid = localdata; struct nid_stat *stats; int rc; ENTRY; - if (client_nid4) { - struct lnet_nid client_nid; + rc = lprocfs_exp_setup(exp, client_nid); - lnet_nid4_to_nid(*client_nid4, &client_nid); - rc = lprocfs_exp_setup(exp, &client_nid); - } else - rc = lprocfs_exp_setup(exp, NULL); if (rc != 0) /* Mask error for already created /proc entries */ RETURN(rc == -EALREADY ? 0 : rc); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index c1436e9..ebdf5d6 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -7008,7 +7008,7 @@ static int mdt_obd_connect(const struct lu_env *env, struct lustre_handle conn = { 0 }; struct mdt_device *mdt; int rc; - lnet_nid_t *client_nid = localdata; + struct lnet_nid *client_nid = localdata; ENTRY; LASSERT(env != NULL); @@ -7042,9 +7042,11 @@ static int mdt_obd_connect(const struct lu_env *env, lexp = class_conn2export(&conn); LASSERT(lexp != NULL); - rc = nodemap_add_member(*client_nid, lexp); - if (rc != 0 && rc != -EEXIST) - GOTO(out, rc); + if (nid_is_nid4(client_nid)) { + rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), lexp); + if (rc != 0 && rc != -EEXIST) + GOTO(out, rc); + } rc = mdt_connect_internal(env, lexp, mdt, data, false); if (rc == 0) { @@ -7081,16 +7083,18 @@ static int mdt_obd_reconnect(const struct lu_env *env, struct obd_connect_data *data, void *localdata) { - lnet_nid_t *client_nid = localdata; - int rc; + struct lnet_nid *client_nid = localdata; + int rc; ENTRY; if (exp == NULL || obd == NULL || cluuid == NULL) RETURN(-EINVAL); - rc = nodemap_add_member(*client_nid, exp); - if (rc != 0 && rc != -EEXIST) - RETURN(rc); + if (nid_is_nid4(client_nid)) { + rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp); + if (rc != 0 && rc != -EEXIST) + RETURN(rc); + } rc = mdt_connect_internal(env, exp, mdt_dev(obd->obd_lu_dev), data, true); diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index 696bdf8..40ec200 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -57,19 +57,13 @@ int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp, void *localdata) { - lnet_nid_t *client_nid4 = localdata; + struct lnet_nid *client_nid = localdata; struct nid_stat *stats; int rc; ENTRY; - if (client_nid4) { - struct lnet_nid client_nid; - - lnet_nid4_to_nid(*client_nid4, &client_nid); - rc = lprocfs_exp_setup(exp, &client_nid); - } else - rc = lprocfs_exp_setup(exp, NULL); + rc = lprocfs_exp_setup(exp, client_nid); if (rc != 0) /* Mask error for already created /proc entries */ RETURN(rc == -EALREADY ? 0 : rc); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index aa538f6..9313dd6 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -64,7 +64,7 @@ */ static int ofd_export_stats_init(struct ofd_device *ofd, struct obd_export *exp, - lnet_nid_t *client_nid4) + struct lnet_nid *client_nid) { struct obd_device *obd = ofd_obd(ofd); struct nid_stat *stats; @@ -76,13 +76,7 @@ static int ofd_export_stats_init(struct ofd_device *ofd, /* Self-export gets no proc entry */ RETURN(0); - if (client_nid4) { - struct lnet_nid client_nid; - - lnet_nid4_to_nid(*client_nid4, &client_nid); - rc = lprocfs_exp_setup(exp, &client_nid); - } else - rc = lprocfs_exp_setup(exp, NULL); + rc = lprocfs_exp_setup(exp, client_nid); if (rc != 0) /* Mask error for already created /proc entries */ RETURN(rc == -EALREADY ? 0 : rc); @@ -303,9 +297,10 @@ static int ofd_parse_connect_data(const struct lu_env *env, static int ofd_obd_reconnect(const struct lu_env *env, struct obd_export *exp, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data, - void *client_nid) + void *localdata) { struct ofd_device *ofd; + struct lnet_nid *client_nid = localdata; int rc; ENTRY; @@ -313,9 +308,11 @@ static int ofd_obd_reconnect(const struct lu_env *env, struct obd_export *exp, if (!exp || !obd || !cluuid) RETURN(-EINVAL); - rc = nodemap_add_member(*(lnet_nid_t *)client_nid, exp); - if (rc != 0 && rc != -EEXIST) - RETURN(rc); + if (nid_is_nid4(client_nid)) { + rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp); + if (rc != 0 && rc != -EEXIST) + RETURN(rc); + } ofd = ofd_dev(obd->obd_lu_dev); @@ -352,6 +349,7 @@ static int ofd_obd_connect(const struct lu_env *env, struct obd_export **_exp, struct obd_export *exp; struct ofd_device *ofd; struct lustre_handle conn = { 0 }; + struct lnet_nid *client_nid = localdata; int rc; ENTRY; @@ -368,8 +366,8 @@ static int ofd_obd_connect(const struct lu_env *env, struct obd_export **_exp, exp = class_conn2export(&conn); LASSERT(exp != NULL); - if (localdata) { - rc = nodemap_add_member(*(lnet_nid_t *)localdata, exp); + if (client_nid && nid_is_nid4(client_nid)) { + rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp); if (rc != 0 && rc != -EEXIST) GOTO(out, rc); } else { @@ -390,7 +388,7 @@ static int ofd_obd_connect(const struct lu_env *env, struct obd_export **_exp, rc = tgt_client_new(env, exp); if (rc != 0) GOTO(out, rc); - ofd_export_stats_init(ofd, exp, localdata); + ofd_export_stats_init(ofd, exp, client_nid); } CDEBUG(D_HA, "%s: get connection from MDS %d\n", obd->obd_name,