Skip to content

Commit 83633ed

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: "Varions small fixes, all in drivers. Some of these arrived during the merge window and got held over to make sure of testing on the -rc tree. The biggest change is for standards conformance in the target driver, closely followed by a set of bug fixes in megaraid_sas" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (21 commits) scsi: ufs: core: Fix typo in comment scsi: mpi3mr: Select CONFIG_SCSI_SAS_ATTRS scsi: ufs: core: Fix typo for register name in comments scsi: pm80xx: Display proc_name in sysfs scsi: ufs: core: Fix the error log in ufshcd_query_flag_retry() scsi: ufs: core: Remove unneeded casts from void * scsi: lpfc: Fix spelling mistake "unsolicted" -> "unsolicited" scsi: qla2xxx: Use transport-defined speed mask for supported_speeds scsi: target: iblock: Fold iblock_emulate_read_cap_with_block_size() into iblock_get_blocks() scsi: qla2xxx: Fix serialization of DCBX TLV data request scsi: ufs: qcom: Remove redundant dev_err() call scsi: megaraid_sas: Move megasas_dbg_lvl init to megasas_init() scsi: megaraid_sas: Remove unnecessary memset() scsi: megaraid_sas: Simplify megasas_update_device_list scsi: megaraid_sas: Correct an error message scsi: megaraid_sas: Correct value passed to scsi_device_lookup() scsi: target: core: UA on all LUNs after reset scsi: target: core: New key must be used for moved PR scsi: target: core: Abort all preempted regs if requested scsi: target: core: Fix memory leak in preempt_and_abort ...
2 parents c6e0e87 + 307539e commit 83633ed

File tree

14 files changed

+96
-55
lines changed

14 files changed

+96
-55
lines changed

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,7 @@ static int lpfcdiag_loop_self_unreg(struct lpfc_hba *phba, uint16_t rpi)
25822582
*
25832583
* This function obtains the transmit and receive ids required to send
25842584
* an unsolicited ct command with a payload. A special lpfc FsType and CmdRsp
2585-
* flags are used to the unsolicted response handler is able to process
2585+
* flags are used to the unsolicited response handler is able to process
25862586
* the ct command sent on the same port.
25872587
**/
25882588
static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi,
@@ -2874,7 +2874,7 @@ diag_cmd_data_alloc(struct lpfc_hba *phba,
28742874
* @len: Number of data bytes
28752875
*
28762876
* This function allocates and posts a data buffer of sufficient size to receive
2877-
* an unsolicted CT command.
2877+
* an unsolicited CT command.
28782878
**/
28792879
static int lpfcdiag_sli3_loop_post_rxbufs(struct lpfc_hba *phba, uint16_t rxxri,
28802880
size_t len)

drivers/scsi/lpfc/lpfc_ct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ lpfc_ct_ignore_hbq_buffer(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
9090
get_job_ulpstatus(phba, piocbq));
9191
}
9292
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
93-
"0145 Ignoring unsolicted CT HBQ Size:%d "
93+
"0145 Ignoring unsolicited CT HBQ Size:%d "
9494
"status = x%x\n",
9595
size, get_job_ulpstatus(phba, piocbq));
9696
}

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5874,10 +5874,6 @@ static void megasas_setup_reply_map(struct megasas_instance *instance)
58745874
static
58755875
int megasas_get_device_list(struct megasas_instance *instance)
58765876
{
5877-
memset(instance->pd_list, 0,
5878-
(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
5879-
memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
5880-
58815877
if (instance->enable_fw_dev_list) {
58825878
if (megasas_host_device_list_query(instance, true))
58835879
return FAILED;
@@ -7220,7 +7216,7 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
72207216

72217217
if (!fusion->ioc_init_request) {
72227218
dev_err(&pdev->dev,
7223-
"Failed to allocate PD list buffer\n");
7219+
"Failed to allocate ioc init request\n");
72247220
return -ENOMEM;
72257221
}
72267222

@@ -7439,7 +7435,6 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance)
74397435
(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY))
74407436
instance->flag_ieee = 1;
74417437

7442-
megasas_dbg_lvl = 0;
74437438
instance->flag = 0;
74447439
instance->unload = 1;
74457440
instance->last_time = 0;
@@ -8762,33 +8757,26 @@ static
87628757
int megasas_update_device_list(struct megasas_instance *instance,
87638758
int event_type)
87648759
{
8765-
int dcmd_ret = DCMD_SUCCESS;
8760+
int dcmd_ret;
87668761

87678762
if (instance->enable_fw_dev_list) {
8768-
dcmd_ret = megasas_host_device_list_query(instance, false);
8769-
if (dcmd_ret != DCMD_SUCCESS)
8770-
goto out;
8763+
return megasas_host_device_list_query(instance, false);
87718764
} else {
87728765
if (event_type & SCAN_PD_CHANNEL) {
87738766
dcmd_ret = megasas_get_pd_list(instance);
8774-
87758767
if (dcmd_ret != DCMD_SUCCESS)
8776-
goto out;
8768+
return dcmd_ret;
87778769
}
87788770

87798771
if (event_type & SCAN_VD_CHANNEL) {
87808772
if (!instance->requestorId ||
87818773
megasas_get_ld_vf_affiliation(instance, 0)) {
8782-
dcmd_ret = megasas_ld_list_query(instance,
8774+
return megasas_ld_list_query(instance,
87838775
MR_LD_QUERY_TYPE_EXPOSED_TO_HOST);
8784-
if (dcmd_ret != DCMD_SUCCESS)
8785-
goto out;
87868776
}
87878777
}
87888778
}
8789-
8790-
out:
8791-
return dcmd_ret;
8779+
return DCMD_SUCCESS;
87928780
}
87938781

87948782
/**
@@ -8918,7 +8906,7 @@ megasas_aen_polling(struct work_struct *work)
89188906
sdev1 = scsi_device_lookup(instance->host,
89198907
MEGASAS_MAX_PD_CHANNELS +
89208908
(ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL),
8921-
(ld_target_id - MEGASAS_MAX_DEV_PER_CHANNEL),
8909+
(ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL),
89228910
0);
89238911
if (sdev1)
89248912
megasas_remove_scsi_device(sdev1);
@@ -9016,6 +9004,7 @@ static int __init megasas_init(void)
90169004
*/
90179005
pr_info("megasas: %s\n", MEGASAS_VERSION);
90189006

9007+
megasas_dbg_lvl = 0;
90199008
support_poll_for_event = 2;
90209009
support_device_change = 1;
90219010
support_nvme_encapsulation = true;

drivers/scsi/mpi3mr/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ config SCSI_MPI3MR
44
tristate "Broadcom MPI3 Storage Controller Device Driver"
55
depends on PCI && SCSI
66
select BLK_DEV_BSGLIB
7+
select SCSI_SAS_ATTRS
78
help
89
MPI3 based Storage & RAID Controllers Driver.

drivers/scsi/pm8001/pm8001_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static void pm8001_map_queues(struct Scsi_Host *shost)
9999
static struct scsi_host_template pm8001_sht = {
100100
.module = THIS_MODULE,
101101
.name = DRV_NAME,
102+
.proc_name = DRV_NAME,
102103
.queuecommand = sas_queuecommand,
103104
.dma_need_drain = ata_scsi_dma_need_drain,
104105
.target_alloc = sas_target_alloc,

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,9 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
951951
if (!capable(CAP_SYS_ADMIN) || off != 0 || count > DCBX_TLV_DATA_SIZE)
952952
return 0;
953953

954+
mutex_lock(&vha->hw->optrom_mutex);
954955
if (ha->dcbx_tlv)
955956
goto do_read;
956-
mutex_lock(&vha->hw->optrom_mutex);
957957
if (qla2x00_chip_is_down(vha)) {
958958
mutex_unlock(&vha->hw->optrom_mutex);
959959
return 0;
@@ -3330,11 +3330,34 @@ struct fc_function_template qla2xxx_transport_vport_functions = {
33303330
.bsg_timeout = qla24xx_bsg_timeout,
33313331
};
33323332

3333+
static uint
3334+
qla2x00_get_host_supported_speeds(scsi_qla_host_t *vha, uint speeds)
3335+
{
3336+
uint supported_speeds = FC_PORTSPEED_UNKNOWN;
3337+
3338+
if (speeds & FDMI_PORT_SPEED_64GB)
3339+
supported_speeds |= FC_PORTSPEED_64GBIT;
3340+
if (speeds & FDMI_PORT_SPEED_32GB)
3341+
supported_speeds |= FC_PORTSPEED_32GBIT;
3342+
if (speeds & FDMI_PORT_SPEED_16GB)
3343+
supported_speeds |= FC_PORTSPEED_16GBIT;
3344+
if (speeds & FDMI_PORT_SPEED_8GB)
3345+
supported_speeds |= FC_PORTSPEED_8GBIT;
3346+
if (speeds & FDMI_PORT_SPEED_4GB)
3347+
supported_speeds |= FC_PORTSPEED_4GBIT;
3348+
if (speeds & FDMI_PORT_SPEED_2GB)
3349+
supported_speeds |= FC_PORTSPEED_2GBIT;
3350+
if (speeds & FDMI_PORT_SPEED_1GB)
3351+
supported_speeds |= FC_PORTSPEED_1GBIT;
3352+
3353+
return supported_speeds;
3354+
}
3355+
33333356
void
33343357
qla2x00_init_host_attr(scsi_qla_host_t *vha)
33353358
{
33363359
struct qla_hw_data *ha = vha->hw;
3337-
u32 speeds = FC_PORTSPEED_UNKNOWN;
3360+
u32 speeds = 0, fdmi_speed = 0;
33383361

33393362
fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
33403363
fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
@@ -3344,7 +3367,8 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
33443367
fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports;
33453368
fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count;
33463369

3347-
speeds = qla25xx_fdmi_port_speed_capability(ha);
3370+
fdmi_speed = qla25xx_fdmi_port_speed_capability(ha);
3371+
speeds = qla2x00_get_host_supported_speeds(vha, fdmi_speed);
33483372

33493373
fc_host_supported_speeds(vha->host) = speeds;
33503374
}

drivers/target/target_core_device.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,25 @@ void target_pr_kref_release(struct kref *kref)
284284
complete(&deve->pr_comp);
285285
}
286286

287+
/*
288+
* Establish UA condition on SCSI device - all LUNs
289+
*/
290+
void target_dev_ua_allocate(struct se_device *dev, u8 asc, u8 ascq)
291+
{
292+
struct se_dev_entry *se_deve;
293+
struct se_lun *lun;
294+
295+
spin_lock(&dev->se_port_lock);
296+
list_for_each_entry(lun, &dev->dev_sep_list, lun_dev_link) {
297+
298+
spin_lock(&lun->lun_deve_lock);
299+
list_for_each_entry(se_deve, &lun->lun_deve_list, lun_link)
300+
core_scsi3_ua_allocate(se_deve, asc, ascq);
301+
spin_unlock(&lun->lun_deve_lock);
302+
}
303+
spin_unlock(&dev->se_port_lock);
304+
}
305+
287306
static void
288307
target_luns_data_has_changed(struct se_node_acl *nacl, struct se_dev_entry *new,
289308
bool skip_new)

drivers/target/target_core_iblock.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,12 @@ static void iblock_unplug_device(struct se_dev_plug *se_plug)
230230
clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags);
231231
}
232232

233-
static unsigned long long iblock_emulate_read_cap_with_block_size(
234-
struct se_device *dev,
235-
struct block_device *bd,
236-
struct request_queue *q)
233+
static sector_t iblock_get_blocks(struct se_device *dev)
237234
{
238-
u32 block_size = bdev_logical_block_size(bd);
235+
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
236+
u32 block_size = bdev_logical_block_size(ib_dev->ibd_bd);
239237
unsigned long long blocks_long =
240-
div_u64(bdev_nr_bytes(bd), block_size) - 1;
238+
div_u64(bdev_nr_bytes(ib_dev->ibd_bd), block_size) - 1;
241239

242240
if (block_size == dev->dev_attrib.block_size)
243241
return blocks_long;
@@ -829,15 +827,6 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
829827
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
830828
}
831829

832-
static sector_t iblock_get_blocks(struct se_device *dev)
833-
{
834-
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
835-
struct block_device *bd = ib_dev->ibd_bd;
836-
struct request_queue *q = bdev_get_queue(bd);
837-
838-
return iblock_emulate_read_cap_with_block_size(dev, bd, q);
839-
}
840-
841830
static sector_t iblock_get_alignment_offset_lbas(struct se_device *dev)
842831
{
843832
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);

drivers/target/target_core_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ int target_configure_device(struct se_device *dev);
8989
void target_free_device(struct se_device *);
9090
int target_for_each_device(int (*fn)(struct se_device *dev, void *data),
9191
void *data);
92+
void target_dev_ua_allocate(struct se_device *dev, u8 asc, u8 ascq);
9293

9394
/* target_core_configfs.c */
9495
extern struct configfs_item_operations target_core_dev_item_ops;

drivers/target/target_core_pr.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,13 +2956,28 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
29562956
__core_scsi3_complete_pro_preempt(dev, pr_reg_n,
29572957
(preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : NULL,
29582958
type, scope, preempt_type);
2959-
2960-
if (preempt_type == PREEMPT_AND_ABORT)
2961-
core_scsi3_release_preempt_and_abort(
2962-
&preempt_and_abort_list, pr_reg_n);
29632959
}
2960+
29642961
spin_unlock(&dev->dev_reservation_lock);
29652962

2963+
/*
2964+
* SPC-4 5.12.11.2.6 Preempting and aborting
2965+
* The actions described in this subclause shall be performed
2966+
* for all I_T nexuses that are registered with the non-zero
2967+
* SERVICE ACTION RESERVATION KEY value, without regard for
2968+
* whether the preempted I_T nexuses hold the persistent
2969+
* reservation. If the SERVICE ACTION RESERVATION KEY field is
2970+
* set to zero and an all registrants persistent reservation is
2971+
* present, the device server shall abort all commands for all
2972+
* registered I_T nexuses.
2973+
*/
2974+
if (preempt_type == PREEMPT_AND_ABORT) {
2975+
core_tmr_lun_reset(dev, NULL, &preempt_and_abort_list,
2976+
cmd);
2977+
core_scsi3_release_preempt_and_abort(
2978+
&preempt_and_abort_list, pr_reg_n);
2979+
}
2980+
29662981
if (pr_tmpl->pr_aptpl_active)
29672982
core_scsi3_update_and_write_aptpl(cmd->se_dev, true);
29682983

@@ -3022,7 +3037,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
30223037
if (calling_it_nexus)
30233038
continue;
30243039

3025-
if (pr_reg->pr_res_key != sa_res_key)
3040+
if (sa_res_key && pr_reg->pr_res_key != sa_res_key)
30263041
continue;
30273042

30283043
pr_reg_nacl = pr_reg->pr_reg_nacl;
@@ -3425,8 +3440,6 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
34253440
* transport protocols where port names are not required;
34263441
* d) Register the reservation key specified in the SERVICE ACTION
34273442
* RESERVATION KEY field;
3428-
* e) Retain the reservation key specified in the SERVICE ACTION
3429-
* RESERVATION KEY field and associated information;
34303443
*
34313444
* Also, It is not an error for a REGISTER AND MOVE service action to
34323445
* register an I_T nexus that is already registered with the same
@@ -3448,6 +3461,12 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
34483461
dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl,
34493462
iport_ptr);
34503463
new_reg = 1;
3464+
} else {
3465+
/*
3466+
* e) Retain the reservation key specified in the SERVICE ACTION
3467+
* RESERVATION KEY field and associated information;
3468+
*/
3469+
dest_pr_reg->pr_res_key = sa_res_key;
34513470
}
34523471
/*
34533472
* f) Release the persistent reservation for the persistent reservation

0 commit comments

Comments
 (0)