@@ -2010,6 +2010,14 @@ static void srpt_free_ch(struct kref *kref)
2010
2010
kfree_rcu (ch , rcu );
2011
2011
}
2012
2012
2013
+ /*
2014
+ * Shut down the SCSI target session, tell the connection manager to
2015
+ * disconnect the associated RDMA channel, transition the QP to the error
2016
+ * state and remove the channel from the channel list. This function is
2017
+ * typically called from inside srpt_zerolength_write_done(). Concurrent
2018
+ * srpt_zerolength_write() calls from inside srpt_close_ch() are possible
2019
+ * as long as the channel is on sport->nexus_list.
2020
+ */
2013
2021
static void srpt_release_channel_work (struct work_struct * w )
2014
2022
{
2015
2023
struct srpt_rdma_ch * ch ;
@@ -2037,6 +2045,11 @@ static void srpt_release_channel_work(struct work_struct *w)
2037
2045
else
2038
2046
ib_destroy_cm_id (ch -> ib_cm .cm_id );
2039
2047
2048
+ sport = ch -> sport ;
2049
+ mutex_lock (& sport -> mutex );
2050
+ list_del_rcu (& ch -> list );
2051
+ mutex_unlock (& sport -> mutex );
2052
+
2040
2053
srpt_destroy_ch_ib (ch );
2041
2054
2042
2055
srpt_free_ioctx_ring ((struct srpt_ioctx * * )ch -> ioctx_ring ,
@@ -2047,11 +2060,6 @@ static void srpt_release_channel_work(struct work_struct *w)
2047
2060
sdev , ch -> rq_size ,
2048
2061
srp_max_req_size , DMA_FROM_DEVICE );
2049
2062
2050
- sport = ch -> sport ;
2051
- mutex_lock (& sport -> mutex );
2052
- list_del_rcu (& ch -> list );
2053
- mutex_unlock (& sport -> mutex );
2054
-
2055
2063
wake_up (& sport -> ch_releaseQ );
2056
2064
2057
2065
kref_put (& ch -> kref , srpt_free_ch );
0 commit comments