Whamcloud - gitweb
LU-18983 nodemap: support obdfilter-survey with nodemap 20/59120/5
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 6 May 2025 16:38:28 +0000 (18:38 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 21 May 2025 05:18:45 +0000 (05:18 +0000)
When running obdfilter-survey case=disk, no nodemap is associated with
the export, as the echo client is setup local to the server and the
ofd is accessed directly. So allow no nodemap for a ECHO_UUID client.
When running obdfilter-survey case=network, the echo client setup on
remote node (usually client) connects to the server via the echo obd.
So the echo obd needs to add the remote nid to the nodemap.

Test-Parameters: trivial
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Ic8464a29e1dd02ae7e453b6a3c9484f130c01d05
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59120
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd.h
lustre/obdecho/echo.c
lustre/obdecho/echo_client.c
lustre/ofd/ofd_io.c

index f75a646..d7391f5 100644 (file)
@@ -504,6 +504,8 @@ struct tgt_thread_big_cache {
 #define LUSTRE_MGS_OBDNAME "MGS"
 #define LUSTRE_MGC_OBDNAME "MGC"
 
+#define LUSTRE_ECHO_UUID "ECHO_UUID"
+
 static inline int is_lwp_on_mdt(char *name)
 {
        char *ptr;
index fd13f0b..13252f9 100644 (file)
@@ -20,6 +20,7 @@
 #include <obd_class.h>
 #include <lustre_dlm.h>
 #include <lprocfs_status.h>
+#include <lustre_nodemap.h>
 
 #include "echo_internal.h"
 
@@ -59,7 +60,9 @@ static int echo_connect(const struct lu_env *env,
                        struct obd_uuid *cluuid, struct obd_connect_data *data,
                        void *localdata)
 {
+       struct lnet_nid *client_nid = localdata;
        struct lustre_handle conn = { 0 };
+       struct obd_export *lexp;
        int rc;
 
        data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
@@ -72,16 +75,38 @@ static int echo_connect(const struct lu_env *env,
                CERROR("can't connect %d\n", rc);
                return rc;
        }
-       *exp = class_conn2export(&conn);
+       lexp = class_conn2export(&conn);
+
+       if (lexp) {
+               rc = nodemap_add_member(client_nid, lexp);
+               if (rc == -EEXIST)
+                       rc = 0;
+               if (rc)
+                       GOTO(out, rc);
+       }
 
-       return 0;
+out:
+       if (rc) {
+               class_disconnect(lexp);
+               nodemap_del_member(lexp);
+               *exp = NULL;
+       } else {
+               *exp = lexp;
+       }
+
+       return rc;
 }
 
 static int echo_disconnect(struct obd_export *exp)
 {
+       int rc;
+
        LASSERT(exp != NULL);
 
-       return server_disconnect_export(exp);
+       rc = server_disconnect_export(exp);
+       nodemap_del_member(exp);
+
+       return rc;
 }
 
 static int echo_init_export(struct obd_export *exp)
index 8f934f6..0378c9b 100644 (file)
@@ -2421,7 +2421,7 @@ static int echo_client_setup(const struct lu_env *env,
 {
        struct echo_client_obd *ec = &obd->u.echo_client;
        struct obd_device *tgt;
-       struct obd_uuid echo_uuid = { "ECHO_UUID" };
+       struct obd_uuid echo_uuid = { LUSTRE_ECHO_UUID };
        struct obd_connect_data *ocd = NULL;
        int rc;
 
index 34d4ae7..ca7b89a 100644 (file)
@@ -1485,7 +1485,11 @@ int ofd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp,
                                                       NODEMAP_FS_TO_CLIENT,
                                                       oa->o_projid);
                } else if (old_rc == 0) {
-                       old_rc = PTR_ERR(nodemap);
+                       /* always allow ECHO client */
+                       if (strcmp(obd_uuid2str(&exp->exp_client_uuid),
+                                  LUSTRE_ECHO_UUID) != 0 ||
+                           exp->exp_connection)
+                               old_rc = PTR_ERR(nodemap);
                }
 
                if (!IS_ERR_OR_NULL(nodemap)) {