@@ -808,15 +808,15 @@ static void smc_listen_work(struct work_struct *work)
808
808
rc = local_contact ;
809
809
if (rc == - ENOMEM )
810
810
reason_code = SMC_CLC_DECL_MEM ;/* insufficient memory*/
811
- goto decline_rdma ;
811
+ goto decline_rdma_unlock ;
812
812
}
813
813
link = & new_smc -> conn .lgr -> lnk [SMC_SINGLE_LINK ];
814
814
815
815
/* create send buffer and rmb */
816
816
rc = smc_buf_create (new_smc );
817
817
if (rc ) {
818
818
reason_code = SMC_CLC_DECL_MEM ;
819
- goto decline_rdma ;
819
+ goto decline_rdma_unlock ;
820
820
}
821
821
822
822
smc_close_init (new_smc );
@@ -831,58 +831,58 @@ static void smc_listen_work(struct work_struct *work)
831
831
buf_desc -> mr_rx [SMC_SINGLE_LINK ]);
832
832
if (rc ) {
833
833
reason_code = SMC_CLC_DECL_INTERR ;
834
- goto decline_rdma ;
834
+ goto decline_rdma_unlock ;
835
835
}
836
836
}
837
837
}
838
838
smc_rmb_sync_sg_for_device (& new_smc -> conn );
839
839
840
840
rc = smc_clc_send_accept (new_smc , local_contact );
841
841
if (rc )
842
- goto out_err ;
842
+ goto out_err_unlock ;
843
843
844
844
/* receive SMC Confirm CLC message */
845
845
reason_code = smc_clc_wait_msg (new_smc , & cclc , sizeof (cclc ),
846
846
SMC_CLC_CONFIRM );
847
847
if (reason_code < 0 )
848
- goto out_err ;
848
+ goto out_err_unlock ;
849
849
if (reason_code > 0 )
850
- goto decline_rdma ;
850
+ goto decline_rdma_unlock ;
851
851
smc_conn_save_peer_info (new_smc , & cclc );
852
852
if (local_contact == SMC_FIRST_CONTACT )
853
853
smc_link_save_peer_info (link , & cclc );
854
854
855
855
rc = smc_rmb_rtoken_handling (& new_smc -> conn , & cclc );
856
856
if (rc ) {
857
857
reason_code = SMC_CLC_DECL_INTERR ;
858
- goto decline_rdma ;
858
+ goto decline_rdma_unlock ;
859
859
}
860
860
861
861
if (local_contact == SMC_FIRST_CONTACT ) {
862
862
rc = smc_ib_ready_link (link );
863
863
if (rc ) {
864
864
reason_code = SMC_CLC_DECL_INTERR ;
865
- goto decline_rdma ;
865
+ goto decline_rdma_unlock ;
866
866
}
867
867
/* QP confirmation over RoCE fabric */
868
868
reason_code = smc_serv_conf_first_link (new_smc );
869
869
if (reason_code < 0 ) {
870
870
/* peer is not aware of a problem */
871
871
rc = reason_code ;
872
- goto out_err ;
872
+ goto out_err_unlock ;
873
873
}
874
874
if (reason_code > 0 )
875
- goto decline_rdma ;
875
+ goto decline_rdma_unlock ;
876
876
}
877
877
878
878
smc_tx_init (new_smc );
879
+ mutex_unlock (& smc_create_lgr_pending );
879
880
880
881
out_connected :
881
882
sk_refcnt_debug_inc (newsmcsk );
882
883
if (newsmcsk -> sk_state == SMC_INIT )
883
884
newsmcsk -> sk_state = SMC_ACTIVE ;
884
885
enqueue :
885
- mutex_unlock (& smc_create_lgr_pending );
886
886
lock_sock_nested (& lsmc -> sk , SINGLE_DEPTH_NESTING );
887
887
if (lsmc -> sk .sk_state == SMC_LISTEN ) {
888
888
smc_accept_enqueue (& lsmc -> sk , newsmcsk );
@@ -896,6 +896,8 @@ static void smc_listen_work(struct work_struct *work)
896
896
sock_put (& lsmc -> sk ); /* sock_hold in smc_tcp_listen_work */
897
897
return ;
898
898
899
+ decline_rdma_unlock :
900
+ mutex_unlock (& smc_create_lgr_pending );
899
901
decline_rdma :
900
902
/* RDMA setup failed, switch back to TCP */
901
903
smc_conn_free (& new_smc -> conn );
@@ -907,6 +909,8 @@ static void smc_listen_work(struct work_struct *work)
907
909
}
908
910
goto out_connected ;
909
911
912
+ out_err_unlock :
913
+ mutex_unlock (& smc_create_lgr_pending );
910
914
out_err :
911
915
newsmcsk -> sk_state = SMC_CLOSED ;
912
916
smc_conn_free (& new_smc -> conn );
0 commit comments