SCSI fixes on 20250703

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.
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCaGaqqyYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishT7aAQDfGp3V
 hNZopNfACuRHEeBa12yPuQiaSGbVKY75xYlbVgEAnVM51besY6K4XTPK3MZnwfvG
 6/ZuTDBeDYS8EyKIaU8=
 =1iR9
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2025-07-03 11:52:39 -07:00
commit 025c1970da
7 changed files with 21 additions and 14 deletions

View File

@ -711,7 +711,7 @@ Description: This file shows the thin provisioning type. This is one of
The file is read only. The file is read only.
What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resourse_count What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resource_count
Date: February 2018 Date: February 2018
Contact: Stanislav Nijnikov <stanislav.nijnikov@wdc.com> Contact: Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
Description: This file shows the total physical memory resources. This is Description: This file shows the total physical memory resources. This is

View File

@ -3705,9 +3705,10 @@ static ssize_t add_target_store(struct device *dev,
target_host->max_id = 1; target_host->max_id = 1;
target_host->max_lun = -1LL; target_host->max_lun = -1LL;
target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb; target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
if (!(ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG)) if (ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG)
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
else
target_host->virt_boundary_mask = ~srp_dev->mr_page_mask; target_host->virt_boundary_mask = ~srp_dev->mr_page_mask;
target = host_to_target(target_host); target = host_to_target(target_host);

View File

@ -473,10 +473,17 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
else else
shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS; shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
shost->virt_boundary_mask = sht->virt_boundary_mask;
if (shost->virt_boundary_mask) {
WARN_ON_ONCE(sht->max_segment_size &&
sht->max_segment_size != UINT_MAX);
shost->max_segment_size = UINT_MAX;
} else {
if (sht->max_segment_size) if (sht->max_segment_size)
shost->max_segment_size = sht->max_segment_size; shost->max_segment_size = sht->max_segment_size;
else else
shost->max_segment_size = BLK_MAX_SEGMENT_SIZE; shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
}
/* 32-byte (dword) is a common minimum for HBAs. */ /* 32-byte (dword) is a common minimum for HBAs. */
if (sht->dma_alignment) if (sht->dma_alignment)
@ -492,9 +499,6 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
else else
shost->dma_boundary = 0xffffffff; shost->dma_boundary = 0xffffffff;
if (sht->virt_boundary_mask)
shost->virt_boundary_mask = sht->virt_boundary_mask;
device_initialize(&shost->shost_gendev); device_initialize(&shost->shost_gendev);
dev_set_name(&shost->shost_gendev, "host%d", shost->host_no); dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
shost->shost_gendev.bus = &scsi_bus_type; shost->shost_gendev.bus = &scsi_bus_type;

View File

@ -2147,7 +2147,7 @@ qla24xx_get_port_database(scsi_qla_host_t *vha, u16 nport_handle,
pdb_dma = dma_map_single(&vha->hw->pdev->dev, pdb, pdb_dma = dma_map_single(&vha->hw->pdev->dev, pdb,
sizeof(*pdb), DMA_FROM_DEVICE); sizeof(*pdb), DMA_FROM_DEVICE);
if (!pdb_dma) { if (dma_mapping_error(&vha->hw->pdev->dev, pdb_dma)) {
ql_log(ql_log_warn, vha, 0x1116, "Failed to map dma buffer.\n"); ql_log(ql_log_warn, vha, 0x1116, "Failed to map dma buffer.\n");
return QLA_MEMORY_ALLOC_FAILED; return QLA_MEMORY_ALLOC_FAILED;
} }

View File

@ -3420,6 +3420,8 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
task_data->data_dma = dma_map_single(&ha->pdev->dev, task->data, task_data->data_dma = dma_map_single(&ha->pdev->dev, task->data,
task->data_count, task->data_count,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (dma_mapping_error(&ha->pdev->dev, task_data->data_dma))
return -ENOMEM;
} }
DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n", DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n",

View File

@ -3384,7 +3384,7 @@ static void sd_read_block_limits_ext(struct scsi_disk *sdkp)
rcu_read_lock(); rcu_read_lock();
vpd = rcu_dereference(sdkp->device->vpd_pgb7); vpd = rcu_dereference(sdkp->device->vpd_pgb7);
if (vpd && vpd->len >= 2) if (vpd && vpd->len >= 6)
sdkp->rscs = vpd->data[5] & 1; sdkp->rscs = vpd->data[5] & 1;
rcu_read_unlock(); rcu_read_unlock();
} }

View File

@ -1808,7 +1808,7 @@ UFS_UNIT_DESC_PARAM(logical_block_size, _LOGICAL_BLK_SIZE, 1);
UFS_UNIT_DESC_PARAM(logical_block_count, _LOGICAL_BLK_COUNT, 8); UFS_UNIT_DESC_PARAM(logical_block_count, _LOGICAL_BLK_COUNT, 8);
UFS_UNIT_DESC_PARAM(erase_block_size, _ERASE_BLK_SIZE, 4); UFS_UNIT_DESC_PARAM(erase_block_size, _ERASE_BLK_SIZE, 4);
UFS_UNIT_DESC_PARAM(provisioning_type, _PROVISIONING_TYPE, 1); UFS_UNIT_DESC_PARAM(provisioning_type, _PROVISIONING_TYPE, 1);
UFS_UNIT_DESC_PARAM(physical_memory_resourse_count, _PHY_MEM_RSRC_CNT, 8); UFS_UNIT_DESC_PARAM(physical_memory_resource_count, _PHY_MEM_RSRC_CNT, 8);
UFS_UNIT_DESC_PARAM(context_capabilities, _CTX_CAPABILITIES, 2); UFS_UNIT_DESC_PARAM(context_capabilities, _CTX_CAPABILITIES, 2);
UFS_UNIT_DESC_PARAM(large_unit_granularity, _LARGE_UNIT_SIZE_M1, 1); UFS_UNIT_DESC_PARAM(large_unit_granularity, _LARGE_UNIT_SIZE_M1, 1);
UFS_UNIT_DESC_PARAM(wb_buf_alloc_units, _WB_BUF_ALLOC_UNITS, 4); UFS_UNIT_DESC_PARAM(wb_buf_alloc_units, _WB_BUF_ALLOC_UNITS, 4);
@ -1825,7 +1825,7 @@ static struct attribute *ufs_sysfs_unit_descriptor[] = {
&dev_attr_logical_block_count.attr, &dev_attr_logical_block_count.attr,
&dev_attr_erase_block_size.attr, &dev_attr_erase_block_size.attr,
&dev_attr_provisioning_type.attr, &dev_attr_provisioning_type.attr,
&dev_attr_physical_memory_resourse_count.attr, &dev_attr_physical_memory_resource_count.attr,
&dev_attr_context_capabilities.attr, &dev_attr_context_capabilities.attr,
&dev_attr_large_unit_granularity.attr, &dev_attr_large_unit_granularity.attr,
&dev_attr_wb_buf_alloc_units.attr, &dev_attr_wb_buf_alloc_units.attr,