Skip to content

Commit f7b0848

Browse files
jgunthorpenmorey
authored andcommitted
verbs: If the uverbs module is not loaded allow get_devices to retry init
[ Upstream commit c306811 ] 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@linux-rdma.org Fixes: c632072 ("verbs: Refresh cahced ibv_device list") Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
1 parent c18601f commit f7b0848

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

libibverbs/device.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,22 @@ LATEST_SYMVER_FUNC(ibv_get_device_list, 1_1, "IBVERBS_1.1",
6464

6565
pthread_mutex_lock(&dev_list_lock);
6666
if (!initialized) {
67-
int ret = ibverbs_init();
67+
char value[8];
68+
int ret;
69+
70+
/*
71+
* The uverbs module is not loaded, this is a ENOSYS return
72+
* but it is not a hard failure, we can try again to see if it
73+
* has become loaded since.
74+
*/
75+
if (ibv_read_sysfs_file(ibv_get_sysfs_path(),
76+
"class/infiniband_verbs/abi_version",
77+
value, sizeof(value)) < 0) {
78+
errno = -ENOSYS;
79+
goto out;
80+
}
81+
82+
ret = ibverbs_init();
6883
initialized = (ret < 0) ? ret : 1;
6984
}
7085

0 commit comments

Comments
 (0)