]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/ulp/srp/ib_srp.c
Merge branch 'upstream' into upstream-jgarzik
[linux-2.6-omap-h63xx.git] / drivers / infiniband / ulp / srp / ib_srp.c
index e9b6a6f07dd723d66abf8448c6c415906e9f3624..5e8ac577f0ad1c33dd9cf65a71d18dd149848822 100644 (file)
@@ -548,6 +548,7 @@ static int srp_reconnect_target(struct srp_target_port *target)
        target->tx_head  = 0;
        target->tx_tail  = 0;
 
+       target->qp_in_error = 0;
        ret = srp_connect_target(target);
        if (ret)
                goto err;
@@ -878,6 +879,7 @@ static void srp_completion(struct ib_cq *cq, void *target_ptr)
                        printk(KERN_ERR PFX "failed %s status %d\n",
                               wc.wr_id & SRP_OP_RECV ? "receive" : "send",
                               wc.status);
+                       target->qp_in_error = 1;
                        break;
                }
 
@@ -1337,6 +1339,8 @@ static int srp_abort(struct scsi_cmnd *scmnd)
 
        printk(KERN_ERR "SRP abort called\n");
 
+       if (target->qp_in_error)
+               return FAILED;
        if (srp_find_req(target, scmnd, &req))
                return FAILED;
        if (srp_send_tsk_mgmt(target, req, SRP_TSK_ABORT_TASK))
@@ -1365,6 +1369,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
 
        printk(KERN_ERR "SRP reset_device called\n");
 
+       if (target->qp_in_error)
+               return FAILED;
        if (srp_find_req(target, scmnd, &req))
                return FAILED;
        if (srp_send_tsk_mgmt(target, req, SRP_TSK_LUN_RESET))
@@ -1621,18 +1627,30 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
                switch (token) {
                case SRP_OPT_ID_EXT:
                        p = match_strdup(args);
+                       if (!p) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
                        target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16));
                        kfree(p);
                        break;
 
                case SRP_OPT_IOC_GUID:
                        p = match_strdup(args);
+                       if (!p) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
                        target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16));
                        kfree(p);
                        break;
 
                case SRP_OPT_DGID:
                        p = match_strdup(args);
+                       if (!p) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
                        if (strlen(p) != 32) {
                                printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p);
                                kfree(p);
@@ -1656,6 +1674,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
 
                case SRP_OPT_SERVICE_ID:
                        p = match_strdup(args);
+                       if (!p) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
                        target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16));
                        kfree(p);
                        break;
@@ -1693,6 +1715,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
 
                case SRP_OPT_INITIATOR_EXT:
                        p = match_strdup(args);
+                       if (!p) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
                        target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16));
                        kfree(p);
                        break;
@@ -1781,6 +1807,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
                goto err_free;
        }
 
+       target->qp_in_error = 0;
        ret = srp_connect_target(target);
        if (ret) {
                printk(KERN_ERR PFX "Connection failed\n");
@@ -1898,7 +1925,7 @@ static void srp_add_one(struct ib_device *device)
         */
        srp_dev->fmr_page_shift = max(9, ffs(dev_attr->page_size_cap) - 1);
        srp_dev->fmr_page_size  = 1 << srp_dev->fmr_page_shift;
-       srp_dev->fmr_page_mask  = ~((unsigned long) srp_dev->fmr_page_size - 1);
+       srp_dev->fmr_page_mask  = ~((u64) srp_dev->fmr_page_size - 1);
 
        INIT_LIST_HEAD(&srp_dev->dev_list);