ib_srpt: Close active sessions when disabling a target

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4202 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-04-10 15:02:13 +00:00
parent e4bc6f2b2b
commit f022a827ba
+13
View File
@@ -2190,6 +2190,8 @@ static bool __srpt_close_ch(struct srpt_rdma_ch *ch)
enum rdma_ch_state prev_state;
bool was_live;
BUG_ON(!ch->cm_id);
sdev = ch->sport->sdev;
was_live = false;
@@ -2272,6 +2274,17 @@ static int srpt_enable_target(struct scst_tgt *scst_tgt, bool enable)
spin_lock_irq(&sdev->spinlock);
sdev->enabled = enable;
if (!enable) {
struct srpt_rdma_ch *ch;
list_for_each_entry(ch, &sdev->rch_list, list) {
PRINT_INFO("Closing channel %s (cm_id %p)"
" because target %s has been disabled",
ch->sess_name, ch->cm_id,
sdev->device->name);
__srpt_close_ch(ch);
}
}
spin_unlock_irq(&sdev->spinlock);
return 0;