[PATCH rdma-core] verbs: If the uverbs module is not loaded allow get_devices to retry init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently if uverbs is not loaded libibverbs latches into a permanent
disabled state on the first try to ibv_get_device_list. This is not
compatible with hot-plug which could insert the uverbs module at any
later point. Recheck for uverbs presence until we get a successful init
or a hard failure during init.

Cc: stable@xxxxxxxxxxxxxx
Fixes: c632072027a8 ("verbs: Refresh cahced ibv_device list")
Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
---
 libibverbs/device.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libibverbs/device.c b/libibverbs/device.c
index 448795a993af21..3900afd3f90bd3 100644
--- a/libibverbs/device.c
+++ b/libibverbs/device.c
@@ -64,7 +64,22 @@ LATEST_SYMVER_FUNC(ibv_get_device_list, 1_1, "IBVERBS_1.1",
 
 	pthread_mutex_lock(&dev_list_lock);
 	if (!initialized) {
-		int ret = ibverbs_init();
+		char value[8];
+		int ret;
+
+		/*
+		 * The uverbs module is not loaded, this is a ENOSYS return
+		 * but it is not a hard failure, we can try again to see if it
+		 * has become loaded since.
+		 */
+		if (ibv_read_sysfs_file(ibv_get_sysfs_path(),
+					"class/infiniband_verbs/abi_version",
+					value, sizeof(value)) < 0) {
+			errno = -ENOSYS;
+			goto out;
+		}
+
+		ret = ibverbs_init();
 		initialized = (ret < 0) ? ret : 1;
 	}
 
-- 
2.19.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux