ib_srpt: Close active sessions when disabling a target (merge r4204 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4237 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-04-26 12:50:50 +00:00
parent e5a1218aa0
commit 89a3e636c5

View File

@@ -2196,6 +2196,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;
@@ -2278,6 +2280,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;