Skip to content

Commit

Permalink
[SCSI] mpt2sas: Expander fix oops saying "Already part of another port"
Browse files Browse the repository at this point in the history
Kernel panic is seen because driver did not tear down the port which should
be dnoe using mpt2sas_transport_port_remove(). without this fix When expander
is added back we would oops inside sas_port_add_phy.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Kashyap, Desai authored and James Bottomley committed Aug 13, 2009
1 parent 15052c9 commit 20f5895
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions drivers/scsi/mpt2sas/mpt2sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
__le64 sas_address;
int i;
unsigned long flags;
struct _sas_port *mpt2sas_port;
struct _sas_port *mpt2sas_port = NULL;
int rc = 0;

if (!handle)
Expand Down Expand Up @@ -3518,12 +3518,20 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
&expander_pg1, i, handle))) {
printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__);
continue;
rc = -1;
goto out_fail;
}
sas_expander->phy[i].handle = handle;
sas_expander->phy[i].phy_id = i;
mpt2sas_transport_add_expander_phy(ioc, &sas_expander->phy[i],
expander_pg1, sas_expander->parent_dev);

if ((mpt2sas_transport_add_expander_phy(ioc,
&sas_expander->phy[i], expander_pg1,
sas_expander->parent_dev))) {
printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__);
rc = -1;
goto out_fail;
}
}

if (sas_expander->enclosure_handle) {
Expand All @@ -3540,8 +3548,9 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)

out_fail:

if (sas_expander)
kfree(sas_expander->phy);
if (mpt2sas_port)
mpt2sas_transport_port_remove(ioc, sas_expander->sas_address,
sas_expander->parent_handle);
kfree(sas_expander);
return rc;
}
Expand Down

0 comments on commit 20f5895

Please sign in to comment.