aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srpt
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2013-05-15 04:30:01 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-05-30 00:30:46 -0400
commit1d19f7800d643b270b28d0a969c5eca455d54397 (patch)
treec4923a798efe13ee2529240602a5235bc632e90e /drivers/infiniband/ulp/srpt
parent9b31a328e344e62e7cc98ae574edcb7b674719bb (diff)
ib_srpt: Call target_sess_cmd_list_set_waiting during shutdown_session
Given that srpt_release_channel_work() calls target_wait_for_sess_cmds() to allow outstanding se_cmd_t->cmd_kref a change to complete, the call to perform target_sess_cmd_list_set_waiting() needs to happen in srpt_shutdown_session() Also, this patch adds an explicit call to srpt_shutdown_session() within srpt_drain_channel() so that target_sess_cmd_list_set_waiting() will be called in the cases where TFO->shutdown_session() is not triggered directly by TCM. Cc: Joern Engel <joern@logfs.org> Cc: Roland Dreier <roland@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/infiniband/ulp/srpt')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c32
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.h1
2 files changed, 25 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 564024e0123a..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"
@@ -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
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index 4caf55cda7b1..3dae156905de 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -325,6 +325,7 @@ struct srpt_rdma_ch {
325 u8 sess_name[36]; 325 u8 sess_name[36];
326 struct work_struct release_work; 326 struct work_struct release_work;
327 struct completion *release_done; 327 struct completion *release_done;
328 bool in_shutdown;
328}; 329};
329 330
330/** 331/**