Skip to content

Commit 025c197

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Driver fixes plus core sd.c fix are all small and obvious. The larger change to hosts.c is less obvious, but required to avoid data corruption caused by bio splitting" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: core: Fix spelling of a sysfs attribute name scsi: core: Enforce unlimited max_segment_size when virt_boundary_mask is set scsi: RDMA/srp: Don't set a max_segment_size when virt_boundary_mask is set scsi: sd: Fix VPD page 0xb7 length check scsi: qla4xxx: Fix missing DMA mapping error in qla4xxx_alloc_pdu() scsi: qla2xxx: Fix DMA mapping test in qla24xx_get_port_database()
2 parents 17bbde2 + 021f243 commit 025c197

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

Documentation/ABI/testing/sysfs-driver-ufs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ Description: This file shows the thin provisioning type. This is one of
711711

712712
The file is read only.
713713

714-
What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resourse_count
714+
What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resource_count
715715
Date: February 2018
716716
Contact: Stanislav Nijnikov <[email protected]>
717717
Description: This file shows the total physical memory resources. This is

drivers/infiniband/ulp/srp/ib_srp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,9 +3705,10 @@ static ssize_t add_target_store(struct device *dev,
37053705
target_host->max_id = 1;
37063706
target_host->max_lun = -1LL;
37073707
target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
3708-
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
37093708

3710-
if (!(ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG))
3709+
if (ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG)
3710+
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
3711+
else
37113712
target_host->virt_boundary_mask = ~srp_dev->mr_page_mask;
37123713

37133714
target = host_to_target(target_host);

drivers/scsi/hosts.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,17 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
473473
else
474474
shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
475475

476-
if (sht->max_segment_size)
477-
shost->max_segment_size = sht->max_segment_size;
478-
else
479-
shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
476+
shost->virt_boundary_mask = sht->virt_boundary_mask;
477+
if (shost->virt_boundary_mask) {
478+
WARN_ON_ONCE(sht->max_segment_size &&
479+
sht->max_segment_size != UINT_MAX);
480+
shost->max_segment_size = UINT_MAX;
481+
} else {
482+
if (sht->max_segment_size)
483+
shost->max_segment_size = sht->max_segment_size;
484+
else
485+
shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
486+
}
480487

481488
/* 32-byte (dword) is a common minimum for HBAs. */
482489
if (sht->dma_alignment)
@@ -492,9 +499,6 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
492499
else
493500
shost->dma_boundary = 0xffffffff;
494501

495-
if (sht->virt_boundary_mask)
496-
shost->virt_boundary_mask = sht->virt_boundary_mask;
497-
498502
device_initialize(&shost->shost_gendev);
499503
dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
500504
shost->shost_gendev.bus = &scsi_bus_type;

drivers/scsi/qla2xxx/qla_mbx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ qla24xx_get_port_database(scsi_qla_host_t *vha, u16 nport_handle,
21472147

21482148
pdb_dma = dma_map_single(&vha->hw->pdev->dev, pdb,
21492149
sizeof(*pdb), DMA_FROM_DEVICE);
2150-
if (!pdb_dma) {
2150+
if (dma_mapping_error(&vha->hw->pdev->dev, pdb_dma)) {
21512151
ql_log(ql_log_warn, vha, 0x1116, "Failed to map dma buffer.\n");
21522152
return QLA_MEMORY_ALLOC_FAILED;
21532153
}

drivers/scsi/qla4xxx/ql4_os.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,8 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
34203420
task_data->data_dma = dma_map_single(&ha->pdev->dev, task->data,
34213421
task->data_count,
34223422
DMA_TO_DEVICE);
3423+
if (dma_mapping_error(&ha->pdev->dev, task_data->data_dma))
3424+
return -ENOMEM;
34233425
}
34243426

34253427
DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n",

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3384,7 +3384,7 @@ static void sd_read_block_limits_ext(struct scsi_disk *sdkp)
33843384

33853385
rcu_read_lock();
33863386
vpd = rcu_dereference(sdkp->device->vpd_pgb7);
3387-
if (vpd && vpd->len >= 2)
3387+
if (vpd && vpd->len >= 6)
33883388
sdkp->rscs = vpd->data[5] & 1;
33893389
rcu_read_unlock();
33903390
}

drivers/ufs/core/ufs-sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ UFS_UNIT_DESC_PARAM(logical_block_size, _LOGICAL_BLK_SIZE, 1);
18081808
UFS_UNIT_DESC_PARAM(logical_block_count, _LOGICAL_BLK_COUNT, 8);
18091809
UFS_UNIT_DESC_PARAM(erase_block_size, _ERASE_BLK_SIZE, 4);
18101810
UFS_UNIT_DESC_PARAM(provisioning_type, _PROVISIONING_TYPE, 1);
1811-
UFS_UNIT_DESC_PARAM(physical_memory_resourse_count, _PHY_MEM_RSRC_CNT, 8);
1811+
UFS_UNIT_DESC_PARAM(physical_memory_resource_count, _PHY_MEM_RSRC_CNT, 8);
18121812
UFS_UNIT_DESC_PARAM(context_capabilities, _CTX_CAPABILITIES, 2);
18131813
UFS_UNIT_DESC_PARAM(large_unit_granularity, _LARGE_UNIT_SIZE_M1, 1);
18141814
UFS_UNIT_DESC_PARAM(wb_buf_alloc_units, _WB_BUF_ALLOC_UNITS, 4);
@@ -1825,7 +1825,7 @@ static struct attribute *ufs_sysfs_unit_descriptor[] = {
18251825
&dev_attr_logical_block_count.attr,
18261826
&dev_attr_erase_block_size.attr,
18271827
&dev_attr_provisioning_type.attr,
1828-
&dev_attr_physical_memory_resourse_count.attr,
1828+
&dev_attr_physical_memory_resource_count.attr,
18291829
&dev_attr_context_capabilities.attr,
18301830
&dev_attr_large_unit_granularity.attr,
18311831
&dev_attr_wb_buf_alloc_units.attr,

0 commit comments

Comments
 (0)