smb_direct_connection_rdma_connect_send rdma_create_id
authorStefan Metzmacher <metze@samba.org>
Fri, 30 Sep 2016 07:21:55 +0000 (09:21 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:11 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index 155a2ba6e7feed592a7319b146eac451dc92e3f1..7ca5a62cb5f983b82f985323fb46643126cf17fd 100644 (file)
@@ -263,22 +263,6 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        set_blocking(c->rdma.cm_channel->fd, false);
 
        c->rdma.context.c = c;
-#if RDMA_USER_CM_MAX_ABI_VERSION >= 2
-       ret = rdma_create_id(c->rdma.cm_channel,
-                            &c->rdma.cm_id,
-                            &c->rdma.context,
-                            RDMA_PS_TCP);
-#else
-#error
-       ret = rdma_create_id(c->rdma.cm_channel,
-                            &c->rdma.cm_id,
-                            &c->rdma.context);
-#endif
-       if (ret != 0) {
-               TALLOC_FREE(c);
-DEBUG(0,("%s:%s: here...\n", __location__, __func__));
-               return NULL;
-       }
 
 //DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        return c;
@@ -726,6 +710,23 @@ static struct tevent_req *smb_direct_connection_rdma_connect_send(TALLOC_CTX *me
        DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        talloc_set_destructor(state, smb_direct_connection_rdma_connect_state_destructor);
 
+#if RDMA_USER_CM_MAX_ABI_VERSION >= 2
+       ret = rdma_create_id(c->rdma.cm_channel,
+                            &c->rdma.cm_id,
+                            &c->rdma.context,
+                            RDMA_PS_TCP);
+#else
+#error
+       ret = rdma_create_id(c->rdma.cm_channel,
+                            &c->rdma.cm_id,
+                            &c->rdma.context);
+#endif
+       if (ret != 0) {
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+               tevent_req_oom(req);
+               return tevent_req_post(req, ev);
+       }
+
        c->rdma.fde_channel = tevent_add_fd(ev, c,
                                        c->rdma.cm_channel->fd,
                                        TEVENT_FD_READ,