Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit fe764a7

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes and updates from James Bottomley: "Fully half this pull is updates to lpfc and qla2xxx which got committed just as the merge window opened. A sizeable fraction of the driver updates are simple bug fixes (and lock reworks for bug fixes in the case of lpfc), so rather than splitting the few actual enhancements out, we're just adding the drivers to the -rc1 pull. The enhancements for lpfc are log message removals, copyright updates and three patches redefining types. For qla2xxx it's just removing a debug message on module removal and the manufacturer detail update. The two major fixes are the sg teardown race and a core error leg problem with the procfs directory not being removed if we destroy a created host that never got to the running state. The rest are minor fixes and constifications" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (41 commits) scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload scsi: core: Fix unremoved procfs host directory regression scsi: mpi3mr: Avoid memcpy field-spanning write WARNING scsi: sd: Fix TCG OPAL unlock on system resume scsi: sg: Avoid sg device teardown race scsi: lpfc: Copyright updates for 14.4.0.1 patches scsi: lpfc: Update lpfc version to 14.4.0.1 scsi: lpfc: Define types in a union for generic void *context3 ptr scsi: lpfc: Define lpfc_dmabuf type for ctx_buf ptr scsi: lpfc: Define lpfc_nodelist type for ctx_ndlp ptr scsi: lpfc: Use a dedicated lock for ras_fwlog state scsi: lpfc: Release hbalock before calling lpfc_worker_wake_up() scsi: lpfc: Replace hbalock with ndlp lock in lpfc_nvme_unregister_port() scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic scsi: lpfc: Remove IRQF_ONESHOT flag from threaded IRQ handling scsi: lpfc: Move NPIV's transport unregistration to after resource clean up scsi: lpfc: Remove unnecessary log message in queuecommand path scsi: qla2xxx: Update version to 10.02.09.200-k scsi: qla2xxx: Delay I/O Abort on PCI error scsi: qla2xxx: Change debug message during driver unload ...
2 parents ac67271 + c214ed2 commit fe764a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+479
-355
lines changed

drivers/ata/libata-eh.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,10 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
712712
ehc->saved_ncq_enabled |= 1 << devno;
713713

714714
/* If we are resuming, wake up the device */
715-
if (ap->pflags & ATA_PFLAG_RESUMING)
715+
if (ap->pflags & ATA_PFLAG_RESUMING) {
716+
dev->flags |= ATA_DFLAG_RESUMING;
716717
ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE;
718+
}
717719
}
718720
}
719721

@@ -3169,6 +3171,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
31693171
return 0;
31703172

31713173
err:
3174+
dev->flags &= ~ATA_DFLAG_RESUMING;
31723175
*r_failed_dev = dev;
31733176
return rc;
31743177
}

drivers/ata/libata-scsi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4730,6 +4730,7 @@ void ata_scsi_dev_rescan(struct work_struct *work)
47304730
struct ata_link *link;
47314731
struct ata_device *dev;
47324732
unsigned long flags;
4733+
bool do_resume;
47334734
int ret = 0;
47344735

47354736
mutex_lock(&ap->scsi_scan_mutex);
@@ -4751,7 +4752,15 @@ void ata_scsi_dev_rescan(struct work_struct *work)
47514752
if (scsi_device_get(sdev))
47524753
continue;
47534754

4755+
do_resume = dev->flags & ATA_DFLAG_RESUMING;
4756+
47544757
spin_unlock_irqrestore(ap->lock, flags);
4758+
if (do_resume) {
4759+
ret = scsi_resume_device(sdev);
4760+
if (ret == -EWOULDBLOCK)
4761+
goto unlock;
4762+
dev->flags &= ~ATA_DFLAG_RESUMING;
4763+
}
47554764
ret = scsi_rescan_device(sdev);
47564765
scsi_device_put(sdev);
47574766
spin_lock_irqsave(ap->lock, flags);

drivers/scsi/bnx2fc/bnx2fc_tgt.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba,
833833

834834
BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n");
835835

836-
spin_lock_bh(&tgt->cq_lock);
837836
ctx_base_ptr = tgt->ctx_base;
838837
tgt->ctx_base = NULL;
839838

@@ -889,7 +888,6 @@ static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba,
889888
tgt->sq, tgt->sq_dma);
890889
tgt->sq = NULL;
891890
}
892-
spin_unlock_bh(&tgt->cq_lock);
893891

894892
if (ctx_base_ptr)
895893
iounmap(ctx_base_ptr);

drivers/scsi/ch.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ do { \
102102

103103
#define MAX_RETRIES 1
104104

105-
static struct class * ch_sysfs_class;
105+
static const struct class ch_sysfs_class = {
106+
.name = "scsi_changer",
107+
};
106108

107109
typedef struct {
108110
struct kref ref;
@@ -930,7 +932,7 @@ static int ch_probe(struct device *dev)
930932
mutex_init(&ch->lock);
931933
kref_init(&ch->ref);
932934
ch->device = sd;
933-
class_dev = device_create(ch_sysfs_class, dev,
935+
class_dev = device_create(&ch_sysfs_class, dev,
934936
MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch,
935937
"s%s", ch->name);
936938
if (IS_ERR(class_dev)) {
@@ -955,7 +957,7 @@ static int ch_probe(struct device *dev)
955957

956958
return 0;
957959
destroy_dev:
958-
device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
960+
device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
959961
put_device:
960962
scsi_device_put(sd);
961963
remove_idr:
@@ -974,7 +976,7 @@ static int ch_remove(struct device *dev)
974976
dev_set_drvdata(dev, NULL);
975977
spin_unlock(&ch_index_lock);
976978

977-
device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor));
979+
device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
978980
scsi_device_put(ch->device);
979981
kref_put(&ch->ref, ch_destroy);
980982
return 0;
@@ -1003,11 +1005,9 @@ static int __init init_ch_module(void)
10031005
int rc;
10041006

10051007
printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n");
1006-
ch_sysfs_class = class_create("scsi_changer");
1007-
if (IS_ERR(ch_sysfs_class)) {
1008-
rc = PTR_ERR(ch_sysfs_class);
1008+
rc = class_register(&ch_sysfs_class);
1009+
if (rc)
10091010
return rc;
1010-
}
10111011
rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops);
10121012
if (rc < 0) {
10131013
printk("Unable to get major %d for SCSI-Changer\n",
@@ -1022,15 +1022,15 @@ static int __init init_ch_module(void)
10221022
fail2:
10231023
unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
10241024
fail1:
1025-
class_destroy(ch_sysfs_class);
1025+
class_unregister(&ch_sysfs_class);
10261026
return rc;
10271027
}
10281028

10291029
static void __exit exit_ch_module(void)
10301030
{
10311031
scsi_unregister_driver(&ch_template.gendrv);
10321032
unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
1033-
class_destroy(ch_sysfs_class);
1033+
class_unregister(&ch_sysfs_class);
10341034
idr_destroy(&ch_index_idr);
10351035
}
10361036

drivers/scsi/cxlflash/main.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ MODULE_AUTHOR("Manoj N. Kumar <manoj@linux.vnet.ibm.com>");
2828
MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>");
2929
MODULE_LICENSE("GPL");
3030

31-
static struct class *cxlflash_class;
31+
static char *cxlflash_devnode(const struct device *dev, umode_t *mode);
32+
static const struct class cxlflash_class = {
33+
.name = "cxlflash",
34+
.devnode = cxlflash_devnode,
35+
};
36+
3237
static u32 cxlflash_major;
3338
static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS);
3439

@@ -3602,7 +3607,7 @@ static int init_chrdev(struct cxlflash_cfg *cfg)
36023607
goto err1;
36033608
}
36043609

3605-
char_dev = device_create(cxlflash_class, NULL, devno,
3610+
char_dev = device_create(&cxlflash_class, NULL, devno,
36063611
NULL, "cxlflash%d", minor);
36073612
if (IS_ERR(char_dev)) {
36083613
rc = PTR_ERR(char_dev);
@@ -3880,14 +3885,12 @@ static int cxlflash_class_init(void)
38803885

38813886
cxlflash_major = MAJOR(devno);
38823887

3883-
cxlflash_class = class_create("cxlflash");
3884-
if (IS_ERR(cxlflash_class)) {
3885-
rc = PTR_ERR(cxlflash_class);
3888+
rc = class_register(&cxlflash_class);
3889+
if (rc) {
38863890
pr_err("%s: class_create failed rc=%d\n", __func__, rc);
38873891
goto err;
38883892
}
38893893

3890-
cxlflash_class->devnode = cxlflash_devnode;
38913894
out:
38923895
pr_debug("%s: returning rc=%d\n", __func__, rc);
38933896
return rc;
@@ -3903,7 +3906,7 @@ static void cxlflash_class_exit(void)
39033906
{
39043907
dev_t devno = MKDEV(cxlflash_major, 0);
39053908

3906-
class_destroy(cxlflash_class);
3909+
class_unregister(&cxlflash_class);
39073910
unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS);
39083911
}
39093912

drivers/scsi/hosts.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,13 @@ static void scsi_host_dev_release(struct device *dev)
353353

354354
if (shost->shost_state == SHOST_CREATED) {
355355
/*
356-
* Free the shost_dev device name here if scsi_host_alloc()
357-
* and scsi_host_put() have been called but neither
356+
* Free the shost_dev device name and remove the proc host dir
357+
* here if scsi_host_{alloc,put}() have been called but neither
358358
* scsi_host_add() nor scsi_remove_host() has been called.
359359
* This avoids that the memory allocated for the shost_dev
360-
* name is leaked.
360+
* name as well as the proc dir structure are leaked.
361361
*/
362+
scsi_proc_hostdir_rm(shost->hostt);
362363
kfree(dev_name(&shost->shost_dev));
363364
}
364365

drivers/scsi/libsas/sas_expander.c

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,16 @@ int sas_discover_root_expander(struct domain_device *dev)
16211621

16221622
/* ---------- Domain revalidation ---------- */
16231623

1624+
static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
1625+
u8 *sas_addr,
1626+
enum sas_device_type *type)
1627+
{
1628+
memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
1629+
*type = to_dev_type(&disc_resp->disc);
1630+
if (*type == SAS_PHY_UNUSED)
1631+
memset(sas_addr, 0, SAS_ADDR_SIZE);
1632+
}
1633+
16241634
static int sas_get_phy_discover(struct domain_device *dev,
16251635
int phy_id, struct smp_disc_resp *disc_resp)
16261636
{
@@ -1674,13 +1684,8 @@ int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
16741684
return -ENOMEM;
16751685

16761686
res = sas_get_phy_discover(dev, phy_id, disc_resp);
1677-
if (res == 0) {
1678-
memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
1679-
SAS_ADDR_SIZE);
1680-
*type = to_dev_type(&disc_resp->disc);
1681-
if (*type == 0)
1682-
memset(sas_addr, 0, SAS_ADDR_SIZE);
1683-
}
1687+
if (res == 0)
1688+
sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
16841689
kfree(disc_resp);
16851690
return res;
16861691
}
@@ -1940,6 +1945,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19401945
struct expander_device *ex = &dev->ex_dev;
19411946
struct ex_phy *phy = &ex->ex_phy[phy_id];
19421947
enum sas_device_type type = SAS_PHY_UNUSED;
1948+
struct smp_disc_resp *disc_resp;
19431949
u8 sas_addr[SAS_ADDR_SIZE];
19441950
char msg[80] = "";
19451951
int res;
@@ -1951,33 +1957,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19511957
SAS_ADDR(dev->sas_addr), phy_id, msg);
19521958

19531959
memset(sas_addr, 0, SAS_ADDR_SIZE);
1954-
res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
1960+
disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
1961+
if (!disc_resp)
1962+
return -ENOMEM;
1963+
1964+
res = sas_get_phy_discover(dev, phy_id, disc_resp);
19551965
switch (res) {
19561966
case SMP_RESP_NO_PHY:
19571967
phy->phy_state = PHY_NOT_PRESENT;
19581968
sas_unregister_devs_sas_addr(dev, phy_id, last);
1959-
return res;
1969+
goto out_free_resp;
19601970
case SMP_RESP_PHY_VACANT:
19611971
phy->phy_state = PHY_VACANT;
19621972
sas_unregister_devs_sas_addr(dev, phy_id, last);
1963-
return res;
1973+
goto out_free_resp;
19641974
case SMP_RESP_FUNC_ACC:
19651975
break;
19661976
case -ECOMM:
19671977
break;
19681978
default:
1969-
return res;
1979+
goto out_free_resp;
19701980
}
19711981

1982+
if (res == 0)
1983+
sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);
1984+
19721985
if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
19731986
phy->phy_state = PHY_EMPTY;
19741987
sas_unregister_devs_sas_addr(dev, phy_id, last);
19751988
/*
1976-
* Even though the PHY is empty, for convenience we discover
1977-
* the PHY to update the PHY info, like negotiated linkrate.
1989+
* Even though the PHY is empty, for convenience we update
1990+
* the PHY info, like negotiated linkrate.
19781991
*/
1979-
sas_ex_phy_discover(dev, phy_id);
1980-
return res;
1992+
if (res == 0)
1993+
sas_set_ex_phy(dev, phy_id, disc_resp);
1994+
goto out_free_resp;
19811995
} else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
19821996
dev_type_flutter(type, phy->attached_dev_type)) {
19831997
struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id);
@@ -1989,7 +2003,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19892003
action = ", needs recovery";
19902004
pr_debug("ex %016llx phy%02d broadcast flutter%s\n",
19912005
SAS_ADDR(dev->sas_addr), phy_id, action);
1992-
return res;
2006+
goto out_free_resp;
19932007
}
19942008

19952009
/* we always have to delete the old device when we went here */
@@ -1998,7 +2012,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19982012
SAS_ADDR(phy->attached_sas_addr));
19992013
sas_unregister_devs_sas_addr(dev, phy_id, last);
20002014

2001-
return sas_discover_new(dev, phy_id);
2015+
res = sas_discover_new(dev, phy_id);
2016+
out_free_resp:
2017+
kfree(disc_resp);
2018+
return res;
20022019
}
20032020

20042021
/**

drivers/scsi/lpfc/lpfc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,6 @@ struct lpfc_hba {
13331333
struct timer_list fabric_block_timer;
13341334
unsigned long bit_flags;
13351335
atomic_t num_rsrc_err;
1336-
atomic_t num_cmd_success;
13371336
unsigned long last_rsrc_error_time;
13381337
unsigned long last_ramp_down_time;
13391338
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -1438,6 +1437,7 @@ struct lpfc_hba {
14381437
struct timer_list inactive_vmid_poll;
14391438

14401439
/* RAS Support */
1440+
spinlock_t ras_fwlog_lock; /* do not take while holding another lock */
14411441
struct lpfc_ras_fwlog ras_fwlog;
14421442

14431443
uint32_t iocb_cnt;

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,9 +5865,9 @@ lpfc_ras_fwlog_buffsize_set(struct lpfc_hba *phba, uint val)
58655865
if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn))
58665866
return -EINVAL;
58675867

5868-
spin_lock_irq(&phba->hbalock);
5868+
spin_lock_irq(&phba->ras_fwlog_lock);
58695869
state = phba->ras_fwlog.state;
5870-
spin_unlock_irq(&phba->hbalock);
5870+
spin_unlock_irq(&phba->ras_fwlog_lock);
58715871

58725872
if (state == REG_INPROGRESS) {
58735873
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging "

0 commit comments

Comments
 (0)