mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-19 22:42:38 +00:00
ib_srpt: Avoid that disabling a target triggers a race condition
Avoid that disabling a target triggers a race condition with SRP relogin. At least in theory this race condition could result in a kernel crash. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5268 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+7
-3
@@ -2340,17 +2340,21 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id)
|
||||
|
||||
static void __srpt_close_all_ch(struct srpt_tgt *srpt_tgt)
|
||||
{
|
||||
struct srpt_rdma_ch *ch, *next_ch;
|
||||
struct srpt_rdma_ch *ch;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
|
||||
lockdep_assert_held(&srpt_tgt->spinlock);
|
||||
#endif
|
||||
|
||||
list_for_each_entry_safe(ch, next_ch, &srpt_tgt->rch_list, list) {
|
||||
restart:
|
||||
list_for_each_entry(ch, &srpt_tgt->rch_list, list) {
|
||||
if (ch->state >= CH_DISCONNECTING)
|
||||
continue;
|
||||
PRINT_INFO("Closing channel %s because target %s has been"
|
||||
" disabled", ch->sess_name,
|
||||
srpt_tgt->scst_tgt->tgt_name);
|
||||
__srpt_close_ch(ch);
|
||||
WARN_ON_ONCE(!__srpt_close_ch(ch));
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user