aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srpt/ib_srpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/ulp/srpt/ib_srpt.c')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index b08ca7a9f76b..3f3f0416fbdd 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2227,6 +2227,27 @@ static void srpt_close_ch(struct srpt_rdma_ch *ch)
2227} 2227}
2228 2228
2229/** 2229/**
2230 * srpt_shutdown_session() - Whether or not a session may be shut down.
2231 */
2232static int srpt_shutdown_session(struct se_session *se_sess)
2233{
2234 struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
2235 unsigned long flags;
2236
2237 spin_lock_irqsave(&ch->spinlock, flags);
2238 if (ch->in_shutdown) {
2239 spin_unlock_irqrestore(&ch->spinlock, flags);
2240 return true;
2241 }
2242
2243 ch->in_shutdown = true;
2244 target_sess_cmd_list_set_waiting(se_sess);
2245 spin_unlock_irqrestore(&ch->spinlock, flags);
2246
2247 return true;
2248}
2249
2250/**
2230 * srpt_drain_channel() - Drain a channel by resetting the IB queue pair. 2251 * srpt_drain_channel() - Drain a channel by resetting the IB queue pair.
2231 * @cm_id: Pointer to the CM ID of the channel to be drained. 2252 * @cm_id: Pointer to the CM ID of the channel to be drained.
2232 * 2253 *
@@ -2264,6 +2285,9 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id)
2264 spin_unlock_irq(&sdev->spinlock); 2285 spin_unlock_irq(&sdev->spinlock);
2265 2286
2266 if (do_reset) { 2287 if (do_reset) {
2288 if (ch->sess)
2289 srpt_shutdown_session(ch->sess);
2290
2267 ret = srpt_ch_qp_err(ch); 2291 ret = srpt_ch_qp_err(ch);
2268 if (ret < 0) 2292 if (ret < 0)
2269 printk(KERN_ERR "Setting queue pair in error state" 2293 printk(KERN_ERR "Setting queue pair in error state"
@@ -2328,7 +2352,7 @@ static void srpt_release_channel_work(struct work_struct *w)
2328 se_sess = ch->sess; 2352 se_sess = ch->sess;
2329 BUG_ON(!se_sess); 2353 BUG_ON(!se_sess);
2330 2354
2331 target_wait_for_sess_cmds(se_sess, 0); 2355 target_wait_for_sess_cmds(se_sess);
2332 2356
2333 transport_deregister_session_configfs(se_sess); 2357 transport_deregister_session_configfs(se_sess);
2334 transport_deregister_session(se_sess); 2358 transport_deregister_session(se_sess);
@@ -3467,14 +3491,6 @@ static void srpt_release_cmd(struct se_cmd *se_cmd)
3467} 3491}
3468 3492
3469/** 3493/**
3470 * srpt_shutdown_session() - Whether or not a session may be shut down.
3471 */
3472static int srpt_shutdown_session(struct se_session *se_sess)
3473{
3474 return true;
3475}
3476
3477/**
3478 * srpt_close_session() - Forcibly close a session. 3494 * srpt_close_session() - Forcibly close a session.
3479 * 3495 *
3480 * Callback function invoked by the TCM core to clean up sessions associated 3496 * Callback function invoked by the TCM core to clean up sessions associated