Skip to content

Commit 6089a91

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: "Four small fixes: three in drivers and one in the core. The core fix is also minor in scope since the bug it fixes is only known to affect systems using SCSI reservations. Of the driver bugs, the libsas one is the most major because it can lead to multiple disks on the same expander not being exposed" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: core: reset host byte in DID_NEXUS_FAILURE case scsi: libsas: Fix rphy phy_identifier for PHYs with end devices attached scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task
2 parents cb268d8 + 4a067cf commit 6089a91

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

drivers/scsi/libiscsi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,13 @@ static int iscsi_xmit_task(struct iscsi_conn *conn)
14591459
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx))
14601460
return -ENODATA;
14611461

1462+
spin_lock_bh(&conn->session->back_lock);
1463+
if (conn->task == NULL) {
1464+
spin_unlock_bh(&conn->session->back_lock);
1465+
return -ENODATA;
1466+
}
14621467
__iscsi_get_task(task);
1468+
spin_unlock_bh(&conn->session->back_lock);
14631469
spin_unlock_bh(&conn->session->frwd_lock);
14641470
rc = conn->session->tt->xmit_task(task);
14651471
spin_lock_bh(&conn->session->frwd_lock);

drivers/scsi/libsas/sas_expander.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ static struct domain_device *sas_ex_discover_end_dev(
828828
rphy = sas_end_device_alloc(phy->port);
829829
if (!rphy)
830830
goto out_free;
831+
rphy->identify.phy_identifier = phy_id;
831832

832833
child->rphy = rphy;
833834
get_device(&rphy->dev);
@@ -854,6 +855,7 @@ static struct domain_device *sas_ex_discover_end_dev(
854855

855856
child->rphy = rphy;
856857
get_device(&rphy->dev);
858+
rphy->identify.phy_identifier = phy_id;
857859
sas_fill_in_rphy(child, rphy);
858860

859861
list_add_tail(&child->disco_list_node, &parent->port->disco_list);

drivers/scsi/scsi_lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
655655
set_host_byte(cmd, DID_OK);
656656
return BLK_STS_TARGET;
657657
case DID_NEXUS_FAILURE:
658+
set_host_byte(cmd, DID_OK);
658659
return BLK_STS_NEXUS;
659660
case DID_ALLOC_FAILURE:
660661
set_host_byte(cmd, DID_OK);

drivers/scsi/sd_zbc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,12 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
142142
return -EOPNOTSUPP;
143143

144144
/*
145-
* Get a reply buffer for the number of requested zones plus a header.
146-
* For ATA, buffers must be aligned to 512B.
145+
* Get a reply buffer for the number of requested zones plus a header,
146+
* without exceeding the device maximum command size. For ATA disks,
147+
* buffers must be aligned to 512B.
147148
*/
148-
buflen = roundup((nrz + 1) * 64, 512);
149+
buflen = min(queue_max_hw_sectors(disk->queue) << 9,
150+
roundup((nrz + 1) * 64, 512));
149151
buf = kmalloc(buflen, gfp_mask);
150152
if (!buf)
151153
return -ENOMEM;

0 commit comments

Comments
 (0)