File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,16 +337,22 @@ static void OnRdmaAsyncEvent(Socket* m) {
337337 }
338338
339339static int ReadRdmaDynamicLib () {
340- g_handle_ibverbs = dlopen (" libibverbs.so" , RTLD_LAZY);
341- if (!g_handle_ibverbs) {
342- LOG (WARNING) << " Failed to load libibverbs.so " << dlerror () << " try libibverbs.so.1" ;
343- // Clear existing error
344- dlerror ();
345- g_handle_ibverbs = dlopen (" libibverbs.so.1" , RTLD_LAZY);
346- if (!g_handle_ibverbs) {
347- LOG (ERROR) << " Fail to load libibverbs.so.1 due to " << dlerror ();
348- return -1 ;
340+ const static char * const kRdmaLibs [] = {
341+ " libibverbs.so" ,
342+ " libibverbs.so.1"
343+ };
344+ for (const char * lib : kRdmaLibs ) {
345+ dlerror (); // Clear existing error
346+ g_handle_ibverbs = dlopen (lib, RTLD_LAZY);
347+ if (g_handle_ibverbs) {
348+ LOG (INFO) << " Successfully loaded " << lib;
349+ break ;
349350 }
351+ LOG (WARNING) << " Failed to load " << lib << " : " << dlerror ();
352+ }
353+ if (!g_handle_ibverbs) {
354+ LOG (ERROR) << " Failed to load any of the RDMA libraries" ;
355+ return -1 ;
350356 }
351357
352358 LoadSymbol (g_handle_ibverbs, IbvGetDeviceList, " ibv_get_device_list" );
You can’t perform that action at this time.
0 commit comments