Whamcloud - gitweb
LU-19021 ptlrpc: Add obd info to nodemap exports output 48/59248/4
authorMarc Vef <mvef@whamcloud.com>
Wed, 21 May 2025 11:35:33 +0000 (13:35 +0200)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Jun 2025 23:03:01 +0000 (23:03 +0000)
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 <mvef@whamcloud.com>
Change-Id: I681480f9258e57c522acc148f4096a8f40c71eab
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59248
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/nodemap_lproc.c

index 026c5b3..63552c2 100644 (file)
@@ -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] = "<unknown>";
+       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, "<unknown>", 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);