Dingshan He
2006-May-19 07:36 UTC
[Lustre-discuss] How to setup additional client-service pair between mds and ost?
Hello,
In my current project, I need to let the obdfilter in an ost send some query
messages directly to the mds and vice versa. Therefore, I am trying to setup
two pairs of client and service between them. My question is about how to
setup such client-service pairs between ost and mds.
What I have done is like following:
- in mds/handler.c, mdt_setup() function, I added following codes
to setup a service
mds->mds_my_service
ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE,
MDS_MAXREQSIZE,
MDS_MY_REQUEST_PORTAL,
OST_MY_REPLY_PORTAL,
MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, "mds_my",
obd->obd_proc_entry);
if(!mds->mds_my_service) {
CERROR("failed to start my
service\n");
GOTO(err_thread3, rc);
}
rc = ptlrpc_start_n_threads(obd, mds->mds_my_service,
MDT_NUM_THREADS,
"ll_mdt_my");
if (rc)
GOTO(err_thread4, rc);
- in obdfilter/filter.c, filter_setup(), I added following codes to
setup a client
#define MDS_UUID "NID_localhost.localdomain_UUID"
struct ptlrpc_connection *conn;
struct filter_obd *filter = &obd->u.filter;
struct obd_import *imp;
struct obd_uuid server_uuid;
memcpy(server_uuid.uuid, MDS_UUID,
min_t(unsigned int, sizeof(MDS_UUID), sizeof(server_uuid)));
conn = ptlrpc_uuid_to_connection(&server_uuid);
if (conn == NULL) {
CWARN("failed to perform
ptlrpc_uuid_to_connection()\n");
GOTO(err_out, rc = -ENOENT);
}
ptlrpc_init_client(MDS_MY_REQUEST_PORTAL, OST_MY_REPLY_PORTAL,
"ost_my_client",
&filter->fo_my_client);
imp = class_new_import();
if (imp == NULL) {
CWARN("class_new_import() returns NULL\n");
ptlrpc_put_connection(conn);
GOTO(err_out, rc = -ENOENT);
}
imp->imp_connection = conn;
imp->imp_client = &obd->u.filter.fo_my_client;
imp->imp_obd = obd;
imp->imp_connect_op = MY_CONNECT;
imp->imp_generation = 0;
imp->imp_initial_recov = 1;
INIT_LIST_HEAD(&imp->imp_pinger_chain);
memcpy(imp->imp_target_uuid.uuid, MDS_UUID, sizeof(MDS_UUID));
class_import_put(imp);
filter->fo_my_imp = imp;
When I look into the log file, I found that the ptlrpc_uuid_to_connection()
returns NULL. Further more, I found that when the obdfilter driver is been
setup, i.e., when the the filter_setup() function is called, the
''g_uuid_list'' is actually empty. It seems that the ost and
obdfilter are
setup even before the connection between ost node and mds node is setup. Is
this true?
My specific questions are following:
1. Is there an existing connection between ost and mds in
lustre-1.4.0? The lustre book says that there are recory, filter status and
filter creation interactions between the OST and the MDS so I assume there
is a connection. However, I cannot find it in the code.
2. Are my previous codes for creating client and service correct to
setup the client-service pair? I think that I am missing the part to setup
an export in the MDS but I don''t know where and how to do this.
Any help is appreciated!
Dingshan