Skip to content

Commit 58330d6

Browse files
Merge branch '6.5/scsi-fixes' into 6.6/scsi-staging
Pull in the fixes tree for a commit that missed 6.5. Also resolve a trivial merge conflict in fnic. * 6.5/scsi-fixes: (36 commits) scsi: storvsc: Handle additional SRB status values scsi: snic: Fix double free in snic_tgt_create() scsi: core: raid_class: Remove raid_component_add() scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW major version > 5 scsi: ufs: mcq: Fix the search/wrap around logic scsi: qedf: Fix firmware halt over suspend and resume scsi: qedi: Fix firmware halt over suspend and resume scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock scsi: lpfc: Remove reftag check in DIF paths scsi: ufs: renesas: Fix private allocation scsi: snic: Fix possible memory leak if device_add() fails scsi: core: Fix possible memory leak if device_add() fails scsi: core: Fix legacy /proc parsing buffer overflow scsi: 53c700: Check that command slot is not NULL scsi: fnic: Replace return codes in fnic_clean_pending_aborts() scsi: storvsc: Fix handling of virtual Fibre Channel timeouts scsi: pm80xx: Fix error return code in pm8001_pci_probe() scsi: zfcp: Defer fc_rport blocking until after ADISC response scsi: storvsc: Limit max_sectors for virtual Fibre Channel devices scsi: sg: Fix checking return value of blk_get_queue() ... Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 15924b0 + 812fe64 commit 58330d6

File tree

33 files changed

+282
-235
lines changed

33 files changed

+282
-235
lines changed

Documentation/ABI/testing/sysfs-driver-ufs

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

block/blk-zoned.c

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ struct blk_revalidate_zone_args {
442442
unsigned long *conv_zones_bitmap;
443443
unsigned long *seq_zones_wlock;
444444
unsigned int nr_zones;
445-
sector_t zone_sectors;
446445
sector_t sector;
447446
};
448447

@@ -456,38 +455,34 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
456455
struct gendisk *disk = args->disk;
457456
struct request_queue *q = disk->queue;
458457
sector_t capacity = get_capacity(disk);
458+
sector_t zone_sectors = q->limits.chunk_sectors;
459+
460+
/* Check for bad zones and holes in the zone report */
461+
if (zone->start != args->sector) {
462+
pr_warn("%s: Zone gap at sectors %llu..%llu\n",
463+
disk->disk_name, args->sector, zone->start);
464+
return -ENODEV;
465+
}
466+
467+
if (zone->start >= capacity || !zone->len) {
468+
pr_warn("%s: Invalid zone start %llu, length %llu\n",
469+
disk->disk_name, zone->start, zone->len);
470+
return -ENODEV;
471+
}
459472

460473
/*
461474
* All zones must have the same size, with the exception on an eventual
462475
* smaller last zone.
463476
*/
464-
if (zone->start == 0) {
465-
if (zone->len == 0 || !is_power_of_2(zone->len)) {
466-
pr_warn("%s: Invalid zoned device with non power of two zone size (%llu)\n",
467-
disk->disk_name, zone->len);
468-
return -ENODEV;
469-
}
470-
471-
args->zone_sectors = zone->len;
472-
args->nr_zones = (capacity + zone->len - 1) >> ilog2(zone->len);
473-
} else if (zone->start + args->zone_sectors < capacity) {
474-
if (zone->len != args->zone_sectors) {
477+
if (zone->start + zone->len < capacity) {
478+
if (zone->len != zone_sectors) {
475479
pr_warn("%s: Invalid zoned device with non constant zone size\n",
476480
disk->disk_name);
477481
return -ENODEV;
478482
}
479-
} else {
480-
if (zone->len > args->zone_sectors) {
481-
pr_warn("%s: Invalid zoned device with larger last zone size\n",
482-
disk->disk_name);
483-
return -ENODEV;
484-
}
485-
}
486-
487-
/* Check for holes in the zone report */
488-
if (zone->start != args->sector) {
489-
pr_warn("%s: Zone gap at sectors %llu..%llu\n",
490-
disk->disk_name, args->sector, zone->start);
483+
} else if (zone->len > zone_sectors) {
484+
pr_warn("%s: Invalid zoned device with larger last zone size\n",
485+
disk->disk_name);
491486
return -ENODEV;
492487
}
493488

@@ -526,11 +521,13 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
526521
* @disk: Target disk
527522
* @update_driver_data: Callback to update driver data on the frozen disk
528523
*
529-
* Helper function for low-level device drivers to (re) allocate and initialize
530-
* a disk request queue zone bitmaps. This functions should normally be called
531-
* within the disk ->revalidate method for blk-mq based drivers. For BIO based
532-
* drivers only q->nr_zones needs to be updated so that the sysfs exposed value
533-
* is correct.
524+
* Helper function for low-level device drivers to check and (re) allocate and
525+
* initialize a disk request queue zone bitmaps. This functions should normally
526+
* be called within the disk ->revalidate method for blk-mq based drivers.
527+
* Before calling this function, the device driver must already have set the
528+
* device zone size (chunk_sector limit) and the max zone append limit.
529+
* For BIO based drivers, this function cannot be used. BIO based device drivers
530+
* only need to set disk->nr_zones so that the sysfs exposed value is correct.
534531
* If the @update_driver_data callback function is not NULL, the callback is
535532
* executed with the device request queue frozen after all zones have been
536533
* checked.
@@ -539,9 +536,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
539536
void (*update_driver_data)(struct gendisk *disk))
540537
{
541538
struct request_queue *q = disk->queue;
542-
struct blk_revalidate_zone_args args = {
543-
.disk = disk,
544-
};
539+
sector_t zone_sectors = q->limits.chunk_sectors;
540+
sector_t capacity = get_capacity(disk);
541+
struct blk_revalidate_zone_args args = { };
545542
unsigned int noio_flag;
546543
int ret;
547544

@@ -550,13 +547,31 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
550547
if (WARN_ON_ONCE(!queue_is_mq(q)))
551548
return -EIO;
552549

553-
if (!get_capacity(disk))
554-
return -EIO;
550+
if (!capacity)
551+
return -ENODEV;
552+
553+
/*
554+
* Checks that the device driver indicated a valid zone size and that
555+
* the max zone append limit is set.
556+
*/
557+
if (!zone_sectors || !is_power_of_2(zone_sectors)) {
558+
pr_warn("%s: Invalid non power of two zone size (%llu)\n",
559+
disk->disk_name, zone_sectors);
560+
return -ENODEV;
561+
}
562+
563+
if (!q->limits.max_zone_append_sectors) {
564+
pr_warn("%s: Invalid 0 maximum zone append limit\n",
565+
disk->disk_name);
566+
return -ENODEV;
567+
}
555568

556569
/*
557570
* Ensure that all memory allocations in this context are done as if
558571
* GFP_NOIO was specified.
559572
*/
573+
args.disk = disk;
574+
args.nr_zones = (capacity + zone_sectors - 1) >> ilog2(zone_sectors);
560575
noio_flag = memalloc_noio_save();
561576
ret = disk->fops->report_zones(disk, 0, UINT_MAX,
562577
blk_revalidate_zone_cb, &args);
@@ -570,7 +585,7 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
570585
* If zones where reported, make sure that the entire disk capacity
571586
* has been checked.
572587
*/
573-
if (ret > 0 && args.sector != get_capacity(disk)) {
588+
if (ret > 0 && args.sector != capacity) {
574589
pr_warn("%s: Missing zones from sector %llu\n",
575590
disk->disk_name, args.sector);
576591
ret = -ENODEV;
@@ -583,7 +598,6 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
583598
*/
584599
blk_mq_freeze_queue(q);
585600
if (ret > 0) {
586-
blk_queue_chunk_sectors(q, args.zone_sectors);
587601
disk->nr_zones = args.nr_zones;
588602
swap(disk->seq_zones_wlock, args.seq_zones_wlock);
589603
swap(disk->conv_zones_bitmap, args.conv_zones_bitmap);

drivers/block/null_blk/zoned.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,15 @@ int null_register_zoned_dev(struct nullb *nullb)
162162
disk_set_zoned(nullb->disk, BLK_ZONED_HM);
163163
blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
164164
blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
165-
166-
if (queue_is_mq(q)) {
167-
int ret = blk_revalidate_disk_zones(nullb->disk, NULL);
168-
169-
if (ret)
170-
return ret;
171-
} else {
172-
blk_queue_chunk_sectors(q, dev->zone_size_sects);
173-
nullb->disk->nr_zones = bdev_nr_zones(nullb->disk->part0);
174-
}
175-
165+
blk_queue_chunk_sectors(q, dev->zone_size_sects);
166+
nullb->disk->nr_zones = bdev_nr_zones(nullb->disk->part0);
176167
blk_queue_max_zone_append_sectors(q, dev->zone_size_sects);
177168
disk_set_max_open_zones(nullb->disk, dev->zone_max_open);
178169
disk_set_max_active_zones(nullb->disk, dev->zone_max_active);
179170

171+
if (queue_is_mq(q))
172+
return blk_revalidate_disk_zones(nullb->disk, NULL);
173+
180174
return 0;
181175
}
182176

drivers/block/virtio_blk.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
751751
{
752752
u32 v, wg;
753753
u8 model;
754-
int ret;
755754

756755
virtio_cread(vdev, struct virtio_blk_config,
757756
zoned.model, &model);
@@ -806,6 +805,7 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
806805
vblk->zone_sectors);
807806
return -ENODEV;
808807
}
808+
blk_queue_chunk_sectors(q, vblk->zone_sectors);
809809
dev_dbg(&vdev->dev, "zone sectors = %u\n", vblk->zone_sectors);
810810

811811
if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
@@ -814,26 +814,22 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
814814
blk_queue_max_discard_sectors(q, 0);
815815
}
816816

817-
ret = blk_revalidate_disk_zones(vblk->disk, NULL);
818-
if (!ret) {
819-
virtio_cread(vdev, struct virtio_blk_config,
820-
zoned.max_append_sectors, &v);
821-
if (!v) {
822-
dev_warn(&vdev->dev, "zero max_append_sectors reported\n");
823-
return -ENODEV;
824-
}
825-
if ((v << SECTOR_SHIFT) < wg) {
826-
dev_err(&vdev->dev,
827-
"write granularity %u exceeds max_append_sectors %u limit\n",
828-
wg, v);
829-
return -ENODEV;
830-
}
831-
832-
blk_queue_max_zone_append_sectors(q, v);
833-
dev_dbg(&vdev->dev, "max append sectors = %u\n", v);
817+
virtio_cread(vdev, struct virtio_blk_config,
818+
zoned.max_append_sectors, &v);
819+
if (!v) {
820+
dev_warn(&vdev->dev, "zero max_append_sectors reported\n");
821+
return -ENODEV;
822+
}
823+
if ((v << SECTOR_SHIFT) < wg) {
824+
dev_err(&vdev->dev,
825+
"write granularity %u exceeds max_append_sectors %u limit\n",
826+
wg, v);
827+
return -ENODEV;
834828
}
829+
blk_queue_max_zone_append_sectors(q, v);
830+
dev_dbg(&vdev->dev, "max append sectors = %u\n", v);
835831

836-
return ret;
832+
return blk_revalidate_disk_zones(vblk->disk, NULL);
837833
}
838834

839835
#else

drivers/nvme/host/zns.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
int nvme_revalidate_zones(struct nvme_ns *ns)
1111
{
1212
struct request_queue *q = ns->queue;
13-
int ret;
1413

15-
ret = blk_revalidate_disk_zones(ns->disk, NULL);
16-
if (!ret)
17-
blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
18-
return ret;
14+
blk_queue_chunk_sectors(q, ns->zsze);
15+
blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
16+
17+
return blk_revalidate_disk_zones(ns->disk, NULL);
1918
}
2019

2120
static int nvme_set_max_append(struct nvme_ctrl *ctrl)

drivers/s390/scsi/zfcp_fc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ static void zfcp_fc_adisc_handler(void *data)
534534

535535
/* re-init to undo drop from zfcp_fc_adisc() */
536536
port->d_id = ntoh24(adisc_resp->adisc_port_id);
537-
/* port is good, unblock rport without going through erp */
538-
zfcp_scsi_schedule_rport_register(port);
537+
/* port is still good, nothing to do */
539538
out:
540539
atomic_andnot(ZFCP_STATUS_PORT_LINK_TEST, &port->status);
541540
put_device(&port->dev);
@@ -595,9 +594,6 @@ void zfcp_fc_link_test_work(struct work_struct *work)
595594
int retval;
596595

597596
set_worker_desc("zadisc%16llx", port->wwpn); /* < WORKER_DESC_LEN=24 */
598-
get_device(&port->dev);
599-
port->rport_task = RPORT_DEL;
600-
zfcp_scsi_rport_work(&port->rport_work);
601597

602598
/* only issue one test command at one time per port */
603599
if (atomic_read(&port->status) & ZFCP_STATUS_PORT_LINK_TEST)

drivers/scsi/53c700.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ NCR_700_intr(int irq, void *dev_id)
15981598
printk("scsi%d (%d:%d) PHASE MISMATCH IN SEND MESSAGE %d remain, return %p[%04x], phase %s\n", host->host_no, pun, lun, count, (void *)temp, temp - hostdata->pScript, sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
15991599
#endif
16001600
resume_offset = hostdata->pScript + Ent_SendMessagePhaseMismatch;
1601-
} else if(dsp >= to32bit(&slot->pSG[0].ins) &&
1601+
} else if (slot && dsp >= to32bit(&slot->pSG[0].ins) &&
16021602
dsp <= to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) {
16031603
int data_transfer = NCR_700_readl(host, DBC_REG) & 0xffffff;
16041604
int SGcount = (dsp - to32bit(&slot->pSG[0].ins))/sizeof(struct NCR_700_SG_List);

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2618,7 +2618,7 @@ struct aac_hba_info {
26182618
struct aac_aifcmd {
26192619
__le32 command; /* Tell host what type of notify this is */
26202620
__le32 seqnum; /* To allow ordering of reports (if necessary) */
2621-
u8 data[1]; /* Undefined length (from kernel viewpoint) */
2621+
u8 data[]; /* Undefined length (from kernel viewpoint) */
26222622
};
26232623

26242624
/**

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
21392139
bool new_sc)
21402140

21412141
{
2142-
int ret = SUCCESS;
2142+
int ret = 0;
21432143
struct fnic_pending_aborts_iter_data iter_data = {
21442144
.fnic = fnic,
21452145
.lun_dev = lr_sc->device,
@@ -2159,9 +2159,11 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
21592159

21602160
/* walk again to check, if IOs are still pending in fw */
21612161
if (fnic_is_abts_pending(fnic, lr_sc))
2162-
ret = FAILED;
2162+
ret = 1;
21632163

21642164
clean_pending_aborts_end:
2165+
FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
2166+
"%s: exit status: %d\n", __func__, ret);
21652167
return ret;
21662168
}
21672169

drivers/scsi/fnic/fnic_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ int fnic_trace_buf_init(void)
465465
fnic_max_trace_entries = (trace_max_pages * PAGE_SIZE)/
466466
FNIC_ENTRY_SIZE_BYTES;
467467

468-
fnic_trace_buf_p = (unsigned long)vzalloc(trace_max_pages * PAGE_SIZE);
468+
fnic_trace_buf_p = (unsigned long)vcalloc(trace_max_pages, PAGE_SIZE);
469469
if (!fnic_trace_buf_p) {
470470
printk(KERN_ERR PFX "Failed to allocate memory "
471471
"for fnic_trace_buf_p\n");

0 commit comments

Comments
 (0)