SCSI fixes on 20230316
Ten patches, eight in drivers and two in the core, which correct a regression from directory removal and add a no VPD size quirk also to fix a regression. All pretty small as you can see from the diffstat. Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com> -----BEGIN PGP SIGNATURE----- iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZBPW8yYcamFtZXMuYm90 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishdl+AQDyZieE 4Ma7ARkNKD+RGsW0qjJ/xMD2kHgkIRuH4vSG5wD+I8a4rXXy5EysOM/z49InCOD1 D2v7CyVEZjTF2qpEcB4= =5HIW -----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: "Ten patches, eight in drivers and two in the core, which correct a regression from directory removal and add a no VPD size quirk also to fix a regression. All pretty small" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: mcq: Use active_reqs to check busy in clock scaling scsi: core: Fix a procfs host directory removal regression scsi: core: Add BLIST_NO_VPD_SIZE for some VDASD scsi: mpi3mr: Fix expander node leak in mpi3mr_remove() scsi: mpi3mr: Fix memory leaks in mpi3mr_init_ioc() scsi: mpi3mr: Fix sas_hba.phy memory leak in mpi3mr_remove() scsi: mpi3mr: Fix mpi3mr_hba_port memory leak in mpi3mr_remove() scsi: mpi3mr: Fix config page DMA memory leak scsi: mpi3mr: Fix throttle_groups memory leak scsi: mpt3sas: Fix NULL pointer access in mpt3sas_transport_port_add()
This commit is contained in:
Коммит
7622976c8f
|
@ -341,9 +341,6 @@ static void scsi_host_dev_release(struct device *dev)
|
|||
struct Scsi_Host *shost = dev_to_shost(dev);
|
||||
struct device *parent = dev->parent;
|
||||
|
||||
/* In case scsi_remove_host() has not been called. */
|
||||
scsi_proc_hostdir_rm(shost->hostt);
|
||||
|
||||
/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
|
||||
rcu_barrier();
|
||||
|
||||
|
|
|
@ -1393,4 +1393,6 @@ void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc);
|
|||
void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc);
|
||||
void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc);
|
||||
int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc);
|
||||
void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
|
||||
struct mpi3mr_sas_node *sas_expander);
|
||||
#endif /*MPI3MR_H_INCLUDED*/
|
||||
|
|
|
@ -3837,29 +3837,34 @@ retry_init:
|
|||
|
||||
mpi3mr_print_ioc_info(mrioc);
|
||||
|
||||
dprint_init(mrioc, "allocating config page buffers\n");
|
||||
mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
|
||||
MPI3MR_DEFAULT_CFG_PAGE_SZ, &mrioc->cfg_page_dma, GFP_KERNEL);
|
||||
if (!mrioc->cfg_page) {
|
||||
retval = -1;
|
||||
goto out_failed_noretry;
|
||||
dprint_init(mrioc, "allocating config page buffers\n");
|
||||
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
|
||||
mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
|
||||
mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL);
|
||||
if (!mrioc->cfg_page) {
|
||||
retval = -1;
|
||||
goto out_failed_noretry;
|
||||
}
|
||||
}
|
||||
|
||||
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
|
||||
|
||||
retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
|
||||
if (retval) {
|
||||
ioc_err(mrioc,
|
||||
"%s :Failed to allocated reply sense buffers %d\n",
|
||||
__func__, retval);
|
||||
goto out_failed_noretry;
|
||||
if (!mrioc->init_cmds.reply) {
|
||||
retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
|
||||
if (retval) {
|
||||
ioc_err(mrioc,
|
||||
"%s :Failed to allocated reply sense buffers %d\n",
|
||||
__func__, retval);
|
||||
goto out_failed_noretry;
|
||||
}
|
||||
}
|
||||
|
||||
retval = mpi3mr_alloc_chain_bufs(mrioc);
|
||||
if (retval) {
|
||||
ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
|
||||
retval);
|
||||
goto out_failed_noretry;
|
||||
if (!mrioc->chain_sgl_list) {
|
||||
retval = mpi3mr_alloc_chain_bufs(mrioc);
|
||||
if (retval) {
|
||||
ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
|
||||
retval);
|
||||
goto out_failed_noretry;
|
||||
}
|
||||
}
|
||||
|
||||
retval = mpi3mr_issue_iocinit(mrioc);
|
||||
|
@ -4382,13 +4387,20 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)
|
|||
mrioc->admin_req_base, mrioc->admin_req_dma);
|
||||
mrioc->admin_req_base = NULL;
|
||||
}
|
||||
|
||||
if (mrioc->cfg_page) {
|
||||
dma_free_coherent(&mrioc->pdev->dev, mrioc->cfg_page_sz,
|
||||
mrioc->cfg_page, mrioc->cfg_page_dma);
|
||||
mrioc->cfg_page = NULL;
|
||||
}
|
||||
if (mrioc->pel_seqnum_virt) {
|
||||
dma_free_coherent(&mrioc->pdev->dev, mrioc->pel_seqnum_sz,
|
||||
mrioc->pel_seqnum_virt, mrioc->pel_seqnum_dma);
|
||||
mrioc->pel_seqnum_virt = NULL;
|
||||
}
|
||||
|
||||
kfree(mrioc->throttle_groups);
|
||||
mrioc->throttle_groups = NULL;
|
||||
|
||||
kfree(mrioc->logdata_buf);
|
||||
mrioc->logdata_buf = NULL;
|
||||
|
||||
|
|
|
@ -5078,6 +5078,8 @@ static void mpi3mr_remove(struct pci_dev *pdev)
|
|||
struct workqueue_struct *wq;
|
||||
unsigned long flags;
|
||||
struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next;
|
||||
struct mpi3mr_hba_port *port, *hba_port_next;
|
||||
struct mpi3mr_sas_node *sas_expander, *sas_expander_next;
|
||||
|
||||
if (!shost)
|
||||
return;
|
||||
|
@ -5117,6 +5119,28 @@ static void mpi3mr_remove(struct pci_dev *pdev)
|
|||
mpi3mr_free_mem(mrioc);
|
||||
mpi3mr_cleanup_resources(mrioc);
|
||||
|
||||
spin_lock_irqsave(&mrioc->sas_node_lock, flags);
|
||||
list_for_each_entry_safe_reverse(sas_expander, sas_expander_next,
|
||||
&mrioc->sas_expander_list, list) {
|
||||
spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
|
||||
mpi3mr_expander_node_remove(mrioc, sas_expander);
|
||||
spin_lock_irqsave(&mrioc->sas_node_lock, flags);
|
||||
}
|
||||
list_for_each_entry_safe(port, hba_port_next, &mrioc->hba_port_table_list, list) {
|
||||
ioc_info(mrioc,
|
||||
"removing hba_port entry: %p port: %d from hba_port list\n",
|
||||
port, port->port_id);
|
||||
list_del(&port->list);
|
||||
kfree(port);
|
||||
}
|
||||
spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
|
||||
|
||||
if (mrioc->sas_hba.num_phys) {
|
||||
kfree(mrioc->sas_hba.phy);
|
||||
mrioc->sas_hba.phy = NULL;
|
||||
mrioc->sas_hba.num_phys = 0;
|
||||
}
|
||||
|
||||
spin_lock(&mrioc_list_lock);
|
||||
list_del(&mrioc->list);
|
||||
spin_unlock(&mrioc_list_lock);
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
|
||||
#include "mpi3mr.h"
|
||||
|
||||
static void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
|
||||
struct mpi3mr_sas_node *sas_expander);
|
||||
|
||||
/**
|
||||
* mpi3mr_post_transport_req - Issue transport requests and wait
|
||||
* @mrioc: Adapter instance reference
|
||||
|
@ -2164,7 +2161,7 @@ out_fail:
|
|||
*
|
||||
* Return nothing.
|
||||
*/
|
||||
static void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
|
||||
void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
|
||||
struct mpi3mr_sas_node *sas_expander)
|
||||
{
|
||||
struct mpi3mr_sas_port *mr_sas_port, *next;
|
||||
|
|
|
@ -785,7 +785,7 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
|
|||
goto out_fail;
|
||||
}
|
||||
port = sas_port_alloc_num(sas_node->parent_dev);
|
||||
if ((sas_port_add(port))) {
|
||||
if (!port || (sas_port_add(port))) {
|
||||
ioc_err(ioc, "failure at %s:%d/%s()!\n",
|
||||
__FILE__, __LINE__, __func__);
|
||||
goto out_fail;
|
||||
|
@ -824,6 +824,12 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
|
|||
mpt3sas_port->remote_identify.sas_address;
|
||||
}
|
||||
|
||||
if (!rphy) {
|
||||
ioc_err(ioc, "failure at %s:%d/%s()!\n",
|
||||
__FILE__, __LINE__, __func__);
|
||||
goto out_delete_port;
|
||||
}
|
||||
|
||||
rphy->identify = mpt3sas_port->remote_identify;
|
||||
|
||||
if ((sas_rphy_add(rphy))) {
|
||||
|
@ -831,6 +837,7 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
|
|||
__FILE__, __LINE__, __func__);
|
||||
sas_rphy_free(rphy);
|
||||
rphy = NULL;
|
||||
goto out_delete_port;
|
||||
}
|
||||
|
||||
if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) {
|
||||
|
@ -857,7 +864,10 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
|
|||
rphy_to_expander_device(rphy), hba_port->port_id);
|
||||
return mpt3sas_port;
|
||||
|
||||
out_fail:
|
||||
out_delete_port:
|
||||
sas_port_delete(port);
|
||||
|
||||
out_fail:
|
||||
list_for_each_entry_safe(mpt3sas_phy, next, &mpt3sas_port->phy_list,
|
||||
port_siblings)
|
||||
list_del(&mpt3sas_phy->port_siblings);
|
||||
|
|
|
@ -326,6 +326,9 @@ static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page)
|
|||
unsigned char vpd_header[SCSI_VPD_HEADER_SIZE] __aligned(4);
|
||||
int result;
|
||||
|
||||
if (sdev->no_vpd_size)
|
||||
return SCSI_DEFAULT_VPD_LEN;
|
||||
|
||||
/*
|
||||
* Fetch the VPD page header to find out how big the page
|
||||
* is. This is done to prevent problems on legacy devices
|
||||
|
|
|
@ -134,7 +134,7 @@ static struct {
|
|||
{"3PARdata", "VV", NULL, BLIST_REPORTLUN2},
|
||||
{"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN},
|
||||
{"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
|
||||
{"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES},
|
||||
{"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES | BLIST_NO_VPD_SIZE},
|
||||
{"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
|
||||
{"BELKIN", "USB 2 HS-CF", "1.95", BLIST_FORCELUN | BLIST_INQUIRY_36},
|
||||
{"BROWNIE", "1200U3P", NULL, BLIST_NOREPORTLUN},
|
||||
|
@ -188,6 +188,7 @@ static struct {
|
|||
{"HPE", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES},
|
||||
{"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN},
|
||||
{"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
|
||||
{"IBM", "2076", NULL, BLIST_NO_VPD_SIZE},
|
||||
{"IBM", "2105", NULL, BLIST_RETRY_HWERROR},
|
||||
{"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN},
|
||||
{"IOMEGA", "ZIP", NULL, BLIST_NOTQ | BLIST_NOLUN},
|
||||
|
|
|
@ -1057,6 +1057,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
|
|||
else if (*bflags & BLIST_SKIP_VPD_PAGES)
|
||||
sdev->skip_vpd_pages = 1;
|
||||
|
||||
if (*bflags & BLIST_NO_VPD_SIZE)
|
||||
sdev->no_vpd_size = 1;
|
||||
|
||||
transport_configure_device(&sdev->sdev_gendev);
|
||||
|
||||
if (sdev->host->hostt->slave_configure) {
|
||||
|
|
|
@ -1500,7 +1500,7 @@ start_window:
|
|||
scaling->window_start_t = curr_t;
|
||||
scaling->tot_busy_t = 0;
|
||||
|
||||
if (hba->outstanding_reqs) {
|
||||
if (scaling->active_reqs) {
|
||||
scaling->busy_start_t = curr_t;
|
||||
scaling->is_busy_started = true;
|
||||
} else {
|
||||
|
@ -2118,7 +2118,7 @@ static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
|
|||
|
||||
spin_lock_irqsave(hba->host->host_lock, flags);
|
||||
hba->clk_scaling.active_reqs--;
|
||||
if (!hba->outstanding_reqs && scaling->is_busy_started) {
|
||||
if (!scaling->active_reqs && scaling->is_busy_started) {
|
||||
scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(),
|
||||
scaling->busy_start_t));
|
||||
scaling->busy_start_t = 0;
|
||||
|
|
|
@ -145,6 +145,7 @@ struct scsi_device {
|
|||
const char * model; /* ... after scan; point to static string */
|
||||
const char * rev; /* ... "nullnullnullnull" before scan */
|
||||
|
||||
#define SCSI_DEFAULT_VPD_LEN 255 /* default SCSI VPD page size (max) */
|
||||
struct scsi_vpd __rcu *vpd_pg0;
|
||||
struct scsi_vpd __rcu *vpd_pg83;
|
||||
struct scsi_vpd __rcu *vpd_pg80;
|
||||
|
@ -215,6 +216,7 @@ struct scsi_device {
|
|||
* creation time */
|
||||
unsigned ignore_media_change:1; /* Ignore MEDIA CHANGE on resume */
|
||||
unsigned silence_suspend:1; /* Do not print runtime PM related messages */
|
||||
unsigned no_vpd_size:1; /* No VPD size reported in header */
|
||||
|
||||
unsigned int queue_stopped; /* request queue is quiesced */
|
||||
bool offline_already; /* Device offline message logged */
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
#define BLIST_IGN_MEDIA_CHANGE ((__force blist_flags_t)(1ULL << 11))
|
||||
/* do not do automatic start on add */
|
||||
#define BLIST_NOSTARTONADD ((__force blist_flags_t)(1ULL << 12))
|
||||
#define __BLIST_UNUSED_13 ((__force blist_flags_t)(1ULL << 13))
|
||||
/* do not ask for VPD page size first on some broken targets */
|
||||
#define BLIST_NO_VPD_SIZE ((__force blist_flags_t)(1ULL << 13))
|
||||
#define __BLIST_UNUSED_14 ((__force blist_flags_t)(1ULL << 14))
|
||||
#define __BLIST_UNUSED_15 ((__force blist_flags_t)(1ULL << 15))
|
||||
#define __BLIST_UNUSED_16 ((__force blist_flags_t)(1ULL << 16))
|
||||
|
@ -74,8 +75,7 @@
|
|||
#define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \
|
||||
(__force blist_flags_t) \
|
||||
((__force __u64)__BLIST_LAST_USED - 1ULL)))
|
||||
#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_13 | \
|
||||
__BLIST_UNUSED_14 | \
|
||||
#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_14 | \
|
||||
__BLIST_UNUSED_15 | \
|
||||
__BLIST_UNUSED_16 | \
|
||||
__BLIST_UNUSED_24 | \
|
||||
|
|
Загрузка…
Ссылка в новой задаче