Skip to content

Commit 9208b75

Browse files
James BottomleyJames Bottomley
authored andcommitted
Merge remote-tracking branch 'mkp-scsi/fixes' into fixes
2 parents 2f5a314 + ffb5845 commit 9208b75

File tree

7 files changed

+61
-26
lines changed

7 files changed

+61
-26
lines changed

drivers/scsi/bfa/bfad_bsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3363,7 +3363,7 @@ bfad_im_bsg_els_ct_request(struct bsg_job *job)
33633363
struct bfad_fcxp *drv_fcxp;
33643364
struct bfa_fcs_lport_s *fcs_port;
33653365
struct bfa_fcs_rport_s *fcs_rport;
3366-
struct fc_bsg_request *bsg_request = bsg_request;
3366+
struct fc_bsg_request *bsg_request = job->request;
33673367
struct fc_bsg_reply *bsg_reply = job->reply;
33683368
uint32_t command_type = bsg_request->msgcode;
33693369
unsigned long flags;

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,12 +3590,14 @@ lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb)
35903590
} else {
35913591
buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2;
35923592
lpfc_els_free_data(phba, buf_ptr1);
3593+
elsiocb->context2 = NULL;
35933594
}
35943595
}
35953596

35963597
if (elsiocb->context3) {
35973598
buf_ptr = (struct lpfc_dmabuf *) elsiocb->context3;
35983599
lpfc_els_free_bpl(phba, buf_ptr);
3600+
elsiocb->context3 = NULL;
35993601
}
36003602
lpfc_sli_release_iocbq(phba, elsiocb);
36013603
return 0;

drivers/scsi/mpt3sas/mpt3sas_base.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ struct MPT3SAS_TARGET {
393393
* @eedp_enable: eedp support enable bit
394394
* @eedp_type: 0(type_1), 1(type_2), 2(type_3)
395395
* @eedp_block_length: block size
396+
* @ata_command_pending: SATL passthrough outstanding for device
396397
*/
397398
struct MPT3SAS_DEVICE {
398399
struct MPT3SAS_TARGET *sas_target;
@@ -404,6 +405,17 @@ struct MPT3SAS_DEVICE {
404405
u8 ignore_delay_remove;
405406
/* Iopriority Command Handling */
406407
u8 ncq_prio_enable;
408+
/*
409+
* Bug workaround for SATL handling: the mpt2/3sas firmware
410+
* doesn't return BUSY or TASK_SET_FULL for subsequent
411+
* commands while a SATL pass through is in operation as the
412+
* spec requires, it simply does nothing with them until the
413+
* pass through completes, causing them possibly to timeout if
414+
* the passthrough is a long executing command (like format or
415+
* secure erase). This variable allows us to do the right
416+
* thing while a SATL command is pending.
417+
*/
418+
unsigned long ata_command_pending;
407419

408420
};
409421

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,9 +3899,18 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc,
38993899
}
39003900
}
39013901

3902-
static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
3902+
static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending)
39033903
{
3904-
return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
3904+
struct MPT3SAS_DEVICE *priv = scmd->device->hostdata;
3905+
3906+
if (scmd->cmnd[0] != ATA_12 && scmd->cmnd[0] != ATA_16)
3907+
return 0;
3908+
3909+
if (pending)
3910+
return test_and_set_bit(0, &priv->ata_command_pending);
3911+
3912+
clear_bit(0, &priv->ata_command_pending);
3913+
return 0;
39053914
}
39063915

39073916
/**
@@ -3925,9 +3934,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc)
39253934
if (!scmd)
39263935
continue;
39273936
count++;
3928-
if (ata_12_16_cmd(scmd))
3929-
scsi_internal_device_unblock(scmd->device,
3930-
SDEV_RUNNING);
3937+
_scsih_set_satl_pending(scmd, false);
39313938
mpt3sas_base_free_smid(ioc, smid);
39323939
scsi_dma_unmap(scmd);
39333940
if (ioc->pci_error_recovery)
@@ -4063,13 +4070,6 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
40634070
if (ioc->logging_level & MPT_DEBUG_SCSI)
40644071
scsi_print_command(scmd);
40654072

4066-
/*
4067-
* Lock the device for any subsequent command until command is
4068-
* done.
4069-
*/
4070-
if (ata_12_16_cmd(scmd))
4071-
scsi_internal_device_block(scmd->device);
4072-
40734073
sas_device_priv_data = scmd->device->hostdata;
40744074
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
40754075
scmd->result = DID_NO_CONNECT << 16;
@@ -4083,6 +4083,19 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
40834083
return 0;
40844084
}
40854085

4086+
/*
4087+
* Bug work around for firmware SATL handling. The loop
4088+
* is based on atomic operations and ensures consistency
4089+
* since we're lockless at this point
4090+
*/
4091+
do {
4092+
if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
4093+
scmd->result = SAM_STAT_BUSY;
4094+
scmd->scsi_done(scmd);
4095+
return 0;
4096+
}
4097+
} while (_scsih_set_satl_pending(scmd, true));
4098+
40864099
sas_target_priv_data = sas_device_priv_data->sas_target;
40874100

40884101
/* invalid device handle */
@@ -4650,8 +4663,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
46504663
if (scmd == NULL)
46514664
return 1;
46524665

4653-
if (ata_12_16_cmd(scmd))
4654-
scsi_internal_device_unblock(scmd->device, SDEV_RUNNING);
4666+
_scsih_set_satl_pending(scmd, false);
46554667

46564668
mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
46574669

drivers/scsi/sd.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
26002600
if (sdp->broken_fua) {
26012601
sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
26022602
sdkp->DPOFUA = 0;
2603-
} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
2603+
} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw &&
2604+
!sdkp->device->use_16_for_rw) {
26042605
sd_first_printk(KERN_NOTICE, sdkp,
26052606
"Uses READ/WRITE(6), disabling FUA\n");
26062607
sdkp->DPOFUA = 0;
@@ -2783,13 +2784,21 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
27832784
queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
27842785
}
27852786

2786-
sdkp->zoned = (buffer[8] >> 4) & 3;
2787-
if (sdkp->zoned == 1)
2788-
q->limits.zoned = BLK_ZONED_HA;
2789-
else if (sdkp->device->type == TYPE_ZBC)
2787+
if (sdkp->device->type == TYPE_ZBC) {
2788+
/* Host-managed */
27902789
q->limits.zoned = BLK_ZONED_HM;
2791-
else
2792-
q->limits.zoned = BLK_ZONED_NONE;
2790+
} else {
2791+
sdkp->zoned = (buffer[8] >> 4) & 3;
2792+
if (sdkp->zoned == 1)
2793+
/* Host-aware */
2794+
q->limits.zoned = BLK_ZONED_HA;
2795+
else
2796+
/*
2797+
* Treat drive-managed devices as
2798+
* regular block devices.
2799+
*/
2800+
q->limits.zoned = BLK_ZONED_NONE;
2801+
}
27932802
if (blk_queue_is_zoned(q) && sdkp->first_scan)
27942803
sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
27952804
q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");

drivers/scsi/ses.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
587587

588588
ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
589589

590-
if (scsi_is_sas_rphy(&sdev->sdev_gendev))
590+
if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent))
591591
efd.addr = sas_get_address(sdev);
592592

593593
if (efd.addr) {

include/scsi/libfc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,11 @@ static inline void fc_set_wwnn(struct fc_lport *lport, u64 wwnn)
809809
/**
810810
* fc_set_wwpn() - Set the World Wide Port Name of a local port
811811
* @lport: The local port whose WWPN is to be set
812-
* @wwnn: The new WWPN
812+
* @wwpn: The new WWPN
813813
*/
814-
static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn)
814+
static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwpn)
815815
{
816-
lport->wwpn = wwnn;
816+
lport->wwpn = wwpn;
817817
}
818818

819819
/**

0 commit comments

Comments
 (0)