diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2018-01-16 16:14:14 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2018-01-18 14:49:26 -0500 |
commit | e28a547da6e9c6dd5ba64b978d361222db3592e7 (patch) | |
tree | 9eb8603b339a52770d8071bf2a716ea38a2f8300 /drivers/infiniband/ulp | |
parent | db7683d7deb25d6edc9c59ac45c56c6a48a45514 (diff) | |
download | op-kernel-dev-e28a547da6e9c6dd5ba64b978d361222db3592e7.zip op-kernel-dev-e28a547da6e9c6dd5ba64b978d361222db3592e7.tar.gz |
IB/srpt: Fix a race condition related to wait list processing
Wait list processing only occurs if the channel state >= CH_LIVE. Hence
set the channel state to CH_LIVE before triggering wait list processing
asynchronously.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 6278c44..372f1eb 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2355,18 +2355,20 @@ static void srpt_cm_rtu_recv(struct srpt_rdma_ch *ch) return; } - /* Trigger wait list processing. */ - ret = srpt_zerolength_write(ch); - WARN_ONCE(ret < 0, "%d\n", ret); - /* * Note: calling srpt_close_ch() if the transition to the LIVE state * fails is not necessary since that means that that function has * already been invoked from another thread. */ - if (!srpt_set_ch_state(ch, CH_LIVE)) + if (!srpt_set_ch_state(ch, CH_LIVE)) { pr_err("%s-%d: channel transition to LIVE state failed\n", ch->sess_name, ch->qp->qp_num); + return; + } + + /* Trigger wait list processing. */ + ret = srpt_zerolength_write(ch); + WARN_ONCE(ret < 0, "%d\n", ret); } /** |