From: Marc Vef Date: Wed, 21 May 2025 11:35:33 +0000 (+0200) Subject: LU-19021 ptlrpc: Add obd info to nodemap exports output X-Git-Tag: 2.16.56~14 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0c1c85c7ec39a9806824f0d5ade7bd3816e8db73;p=fs%2Flustre-release.git LU-19021 ptlrpc: Add obd info to nodemap exports output When clients connect to MDTs/OSTs, a new export is generated on the server-side during obd_connect_*() with the client's UUID. For each target, a separate export is created which is then added to the nodemap's "nm_member_list", if applicable. Currently, "lctl get_param nodemap.NM_NAME.exports" prints the UUID and NID information for each entry in the "nm_member_list". Because the obd device is not listed, duplicate entries appear to be shown for each client, which can be confusing for the administrator. This patch extends the nodemap.NM_NAME.exports output by also showing the obd the client is connected to, e.g., MDT0000, MDT0001, etc, such that the shown entries no longer appear as duplucate. Signed-off-by: Marc Vef Change-Id: I681480f9258e57c522acc148f4096a8f40c71eab Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59248 Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c index 026c5b3..63552c2 100644 --- a/lustre/ptlrpc/nodemap_lproc.c +++ b/lustre/ptlrpc/nodemap_lproc.c @@ -348,17 +348,21 @@ out: LDEBUGFS_SEQ_FOPS(nodemap_sepol); /** - * Reads and prints the exports attached to the given nodemap. + * nodemap_exports_show() - Reads and prints the exports attached + * to the given nodemap * - * \param m seq file in proc fs, stores nodemap - * \param data unused - * \retval 0 success + * @m: seq file in proc fs, stores nodemap + * @unused: unused + * + * Return: + * * %0 on success + * * negative error code on failure */ -static int nodemap_exports_show(struct seq_file *m, void *data) +static int nodemap_exports_show(struct seq_file *m, void *unused) { struct lu_nodemap *nodemap; struct obd_export *exp; - char nidstr[LNET_NIDSTR_SIZE] = ""; + char nidstr[LNET_NIDSTR_SIZE]; bool cont = false; int rc; @@ -368,7 +372,7 @@ static int nodemap_exports_show(struct seq_file *m, void *data) if (IS_ERR(nodemap)) { rc = PTR_ERR(nodemap); CERROR("cannot find nodemap '%s': rc = %d\n", - (char *)m->private, rc); + (char *)m->private, rc); return rc; } @@ -377,14 +381,17 @@ static int nodemap_exports_show(struct seq_file *m, void *data) mutex_lock(&nodemap->nm_member_list_lock); list_for_each_entry(exp, &nodemap->nm_member_list, exp_target_data.ted_nodemap_member) { - if (exp->exp_connection != NULL) + if (exp->exp_connection) libcfs_nidstr_r(&exp->exp_connection->c_peer.nid, - nidstr, sizeof(nidstr)); + nidstr, sizeof(nidstr)); + else + strscpy(nidstr, "", sizeof(nidstr)); + if (cont) seq_puts(m, ","); cont = true; - seq_printf(m, "\n { nid: %s, uuid: %s }", - nidstr, exp->exp_client_uuid.uuid); + seq_printf(m, "\n { nid: %s, uuid: %s, dev: %s }", nidstr, + exp->exp_client_uuid.uuid, exp->exp_obd->obd_name); } mutex_unlock(&nodemap->nm_member_list_lock);