#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;
#include <obd_class.h>
#include <lustre_dlm.h>
#include <lprocfs_status.h>
+#include <lustre_nodemap.h>
#include "echo_internal.h"
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;
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)
{
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;
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)) {