lkml.org 
[lkml]   [2018]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/8] scsi: libsas: always unregister the old device if going to discover new
From
Date
On 29/05/2018 03:23, Jason Yan wrote:
> If we went into sas_rediscover_dev() the attached_sas_addr was already
> insured not to be zero. So it's unnecessary to check if the
> attached_sas_addr is zero.
>
> And although if the sas address is not changed, we always have to
> unregister the old device when we are going to register a new one. We
> cannot just leave the device there and bring up the new.
>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> CC: chenxiang <chenxiang66@hisilicon.com>
> CC: John Garry <john.garry@huawei.com>
> CC: Johannes Thumshirn <jthumshirn@suse.de>
> CC: Ewan Milne <emilne@redhat.com>
> CC: Christoph Hellwig <hch@lst.de>
> CC: Tomas Henzl <thenzl@redhat.com>
> CC: Dan Williams <dan.j.williams@intel.com>
> CC: Hannes Reinecke <hare@suse.com>
> ---
> drivers/scsi/libsas/sas_expander.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
> index 8b7114348def..629c580d906b 100644
> --- a/drivers/scsi/libsas/sas_expander.c
> +++ b/drivers/scsi/libsas/sas_expander.c
> @@ -2054,14 +2054,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
> return res;
> }
>
> - /* delete the old link */
> - if (SAS_ADDR(phy->attached_sas_addr) &&
> - SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) {
> - SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
> - SAS_ADDR(dev->sas_addr), phy_id,
> - SAS_ADDR(phy->attached_sas_addr));
> - sas_unregister_devs_sas_addr(dev, phy_id, last);
> - }

The preceeding checks in code check for no device/comm fail or SATA flutter.

If we're rediscovering the device and the SAS address has not changed,
then why previously still try to discover a new device? I'm guessing
sas_discover_new() had no affect in this case, since maybe since the PHY
was already discovered. But that would not make sense since you say "we
are going to register a new one". Or, if we are always going to register
a new one, how did we ensure we always unregistered the old device
previously (when SAS address did not change)?

> + /* we always have to delete the old device when we went here */
> + SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
> + SAS_ADDR(dev->sas_addr), phy_id,
> + SAS_ADDR(phy->attached_sas_addr));
> + sas_unregister_devs_sas_addr(dev, phy_id, last);
>
> return sas_discover_new(dev, phy_id);
> }
>


\
 
 \ /
  Last update: 2018-05-31 17:11    [W:0.062 / U:0.980 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site