Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / drivers / infiniband / ulp / iser / iscsi_iser.c
index c7a3d75fb30806c2f6fe6fa5d38bcfb8a4d3e1db..2e72fc5af15732db4f349917ffe6ad4fad946190 100644 (file)
@@ -611,6 +611,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
        struct Scsi_Host *shost;
        struct iser_conn *iser_conn = NULL;
        struct ib_conn *ib_conn;
        struct Scsi_Host *shost;
        struct iser_conn *iser_conn = NULL;
        struct ib_conn *ib_conn;
+       struct ib_device *ib_dev;
        u32 max_fr_sectors;
 
        shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
        u32 max_fr_sectors;
 
        shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
@@ -641,16 +642,19 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
                }
 
                ib_conn = &iser_conn->ib_conn;
                }
 
                ib_conn = &iser_conn->ib_conn;
+               ib_dev = ib_conn->device->ib_device;
                if (ib_conn->pi_support) {
                if (ib_conn->pi_support) {
-                       u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap;
+                       u32 sig_caps = ib_dev->attrs.sig_prot_cap;
 
                        scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps));
                        scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP |
                                                   SHOST_DIX_GUARD_CRC);
                }
 
 
                        scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps));
                        scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP |
                                                   SHOST_DIX_GUARD_CRC);
                }
 
-               if (iscsi_host_add(shost,
-                                  ib_conn->device->ib_device->dev.parent)) {
+               if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
+                       shost->virt_boundary_mask = ~MASK_4K;
+
+               if (iscsi_host_add(shost, ib_dev->dev.parent)) {
                        mutex_unlock(&iser_conn->state_mutex);
                        goto free_host;
                }
                        mutex_unlock(&iser_conn->state_mutex);
                        goto free_host;
                }
@@ -956,30 +960,6 @@ static umode_t iser_attr_is_visible(int param_type, int param)
        return 0;
 }
 
        return 0;
 }
 
-static int iscsi_iser_slave_alloc(struct scsi_device *sdev)
-{
-       struct iscsi_session *session;
-       struct iser_conn *iser_conn;
-       struct ib_device *ib_dev;
-
-       mutex_lock(&unbind_iser_conn_mutex);
-
-       session = starget_to_session(scsi_target(sdev))->dd_data;
-       iser_conn = session->leadconn->dd_data;
-       if (!iser_conn) {
-               mutex_unlock(&unbind_iser_conn_mutex);
-               return -ENOTCONN;
-       }
-       ib_dev = iser_conn->ib_conn.device->ib_device;
-
-       if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
-               blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K);
-
-       mutex_unlock(&unbind_iser_conn_mutex);
-
-       return 0;
-}
-
 static struct scsi_host_template iscsi_iser_sht = {
        .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over iSER",
 static struct scsi_host_template iscsi_iser_sht = {
        .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over iSER",
@@ -992,7 +972,6 @@ static struct scsi_host_template iscsi_iser_sht = {
        .eh_device_reset_handler= iscsi_eh_device_reset,
        .eh_target_reset_handler = iscsi_eh_recover_target,
        .target_alloc           = iscsi_target_alloc,
        .eh_device_reset_handler= iscsi_eh_device_reset,
        .eh_target_reset_handler = iscsi_eh_recover_target,
        .target_alloc           = iscsi_target_alloc,
-       .slave_alloc            = iscsi_iser_slave_alloc,
        .proc_name              = "iscsi_iser",
        .this_id                = -1,
        .track_queue_depth      = 1,
        .proc_name              = "iscsi_iser",
        .this_id                = -1,
        .track_queue_depth      = 1,