Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/iwcm: Use a default listen backlog if needed

If the user creates a listening cm_id with backlog of 0 the IWCM ends
up not allowing any connection requests at all. The correct behavior
is for the IWCM to pick a default value if the user backlog parameter
is zero.

Lustre from version 1.8.8 onward uses a backlog of 0, which breaks
iwarp support without this fix.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>

authored by

Steve Wise and committed by
Roland Dreier
2f0304d2 64aa90f2

+27
+27
drivers/infiniband/core/iwcm.c
··· 46 46 #include <linux/completion.h> 47 47 #include <linux/slab.h> 48 48 #include <linux/module.h> 49 + #include <linux/sysctl.h> 49 50 50 51 #include <rdma/iw_cm.h> 51 52 #include <rdma/ib_addr.h> ··· 64 63 struct list_head list; 65 64 struct iw_cm_event event; 66 65 struct list_head free_list; 66 + }; 67 + 68 + static unsigned int default_backlog = 256; 69 + 70 + static struct ctl_table_header *iwcm_ctl_table_hdr; 71 + static struct ctl_table iwcm_ctl_table[] = { 72 + { 73 + .procname = "default_backlog", 74 + .data = &default_backlog, 75 + .maxlen = sizeof(default_backlog), 76 + .mode = 0644, 77 + .proc_handler = proc_dointvec, 78 + }, 79 + { } 67 80 }; 68 81 69 82 /* ··· 439 424 int ret; 440 425 441 426 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); 427 + 428 + if (!backlog) 429 + backlog = default_backlog; 442 430 443 431 ret = alloc_work_entries(cm_id_priv, backlog); 444 432 if (ret) ··· 1048 1030 if (!iwcm_wq) 1049 1031 return -ENOMEM; 1050 1032 1033 + iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", 1034 + iwcm_ctl_table); 1035 + if (!iwcm_ctl_table_hdr) { 1036 + pr_err("iw_cm: couldn't register sysctl paths\n"); 1037 + destroy_workqueue(iwcm_wq); 1038 + return -ENOMEM; 1039 + } 1040 + 1051 1041 return 0; 1052 1042 } 1053 1043 1054 1044 static void __exit iw_cm_cleanup(void) 1055 1045 { 1046 + unregister_net_sysctl_table(iwcm_ctl_table_hdr); 1056 1047 destroy_workqueue(iwcm_wq); 1057 1048 } 1058 1049