spin_unlock_irq(&sdev->spinlock);
 }
 
+/**
+ * srpt_shutdown_session() - Whether or not a session may be shut down.
+ */
+static int srpt_shutdown_session(struct se_session *se_sess)
+{
+       struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ch->spinlock, flags);
+       if (ch->in_shutdown) {
+               spin_unlock_irqrestore(&ch->spinlock, flags);
+               return true;
+       }
+
+       ch->in_shutdown = true;
+       target_sess_cmd_list_set_waiting(se_sess);
+       spin_unlock_irqrestore(&ch->spinlock, flags);
+
+       return true;
+}
+
 /**
  * srpt_drain_channel() - Drain a channel by resetting the IB queue pair.
  * @cm_id: Pointer to the CM ID of the channel to be drained.
        spin_unlock_irq(&sdev->spinlock);
 
        if (do_reset) {
+               if (ch->sess)
+                       srpt_shutdown_session(ch->sess);
+
                ret = srpt_ch_qp_err(ch);
                if (ret < 0)
                        printk(KERN_ERR "Setting queue pair in error state"
        spin_unlock_irqrestore(&ch->spinlock, flags);
 }
 
-/**
- * srpt_shutdown_session() - Whether or not a session may be shut down.
- */
-static int srpt_shutdown_session(struct se_session *se_sess)
-{
-       return true;
-}
-
 /**
  * srpt_close_session() - Forcibly close a session.
  *