Cleanups
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 3 Mar 2009 17:00:53 +0000 (17:00 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 3 Mar 2009 17:00:53 +0000 (17:00 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@682 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/include/scst.h
scst_local/scst_local.c
srpt/src/ib_srpt.c
srpt/src/ib_srpt.h

index 8fff1a3..49ffeeb 100644 (file)
@@ -1638,7 +1638,8 @@ void scst_unregister(struct scst_tgt *tgt);
  *
  * Parameters:
  *   tgt    - target
- *   atomic - true, if the function called in the atomic context
+ *   atomic - true, if the function called in the atomic context. If false,
+ *     this function will block until the session registration is completed.
  *   initiator_name - remote initiator's name, any NULL-terminated string,
  *      e.g. iSCSI name, which used as the key to found appropriate access
  *      control group. Could be NULL, then "default" group is used.
index a9e10fd..c045b2e 100644 (file)
@@ -616,7 +616,7 @@ static int scst_local_add_adapter(void)
                sprintf(name, "scstlclhst%d:%d", scst_local_add_host, i);
                scst_lcl_host->session[i] = scst_register_session(
                                                scst_lcl_host->target,
-                                               TRUE, name, NULL, NULL);
+                                               0, name, NULL, NULL);
                if (!scst_lcl_host->session[i]) {
                        printk(KERN_WARNING "scst_register_session failed:\n");
                        error = -1;
index e0fe8ab..9309dcb 100644 (file)
@@ -1161,26 +1161,6 @@ static int srpt_release_channel(struct srpt_rdma_ch *ch, int destroy_cmid)
        return destroy_cmid ? 0 : 1;
 }
 
-static void srpt_register_channel_done(struct scst_session *scst_sess,
-                                      void *data, int status)
-{
-       struct srpt_rdma_ch *ch = data;
-
-       BUG_ON(!ch);
-
-       if (status) {
-               if (ch->scst_sess) {
-                       scst_unregister_session(ch->scst_sess, 0, NULL);
-                       ch->scst_sess = NULL;
-               }
-               printk(KERN_ERR PFX
-                      "%s: Failed to establish sess= %p status= %d\n",
-                      __func__, scst_sess, status);
-       }
-
-       complete(&ch->scst_sess_done);
-}
-
 static int srpt_disconnect_channel(struct srpt_rdma_ch *ch, int dreq)
 {
        spin_lock_irq(&ch->spinlock);
@@ -1327,19 +1307,15 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
                goto destroy_ib;
        }
 
-       init_completion(&ch->scst_sess_done);
        sprintf(ch->sess_name, "0x%016llx%016llx",
                (unsigned long long)be64_to_cpu(*(u64 *)ch->i_port_id),
                (unsigned long long)be64_to_cpu(*(u64 *)(ch->i_port_id + 8)));
-       ch->scst_sess =
-           scst_register_session(sdev->scst_tgt, 1, ch->sess_name,
-                                 ch, srpt_register_channel_done);
-
-       wait_for_completion(&ch->scst_sess_done);
 
+       ch->scst_sess = scst_register_session(sdev->scst_tgt, 0, ch->sess_name,
+                                 NULL, NULL);
        if (!ch->scst_sess) {
                rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
-               printk(KERN_WARNING PFX "Reject failed to create scst sess");
+               printk(KERN_WARNING PFX "Failed to create scst sess\n");
                goto destroy_ib;
        }
 
index b34533c..39e99c4 100644 (file)
@@ -142,7 +142,6 @@ struct srpt_rdma_ch {
        struct list_head active_scmnd_list;
        u32 active_scmnd_cnt;
 
-       struct completion scst_sess_done;
        struct scst_session *scst_sess;
        u8 sess_name[32];
 };