Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460236

[PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address.

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address.
Date 2016-08-11 10:00 +0200
Message-ID <s4T4d-Vn-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Since commit 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS
enclosures') ses_match_to_enclosure() is calling sas_get_address(),
which is coming from commit bcf508c13385 ('scsi_transport_sas: add
function to get SAS endpoint address'). sas_get_address() itself calls
sas_sdev_to_rdev() which BUG_ON()s if a given scsi_device's rphy is
not a SAS_END_DEVICE.

As SAS Enclosure is a SAS expander device, we really shouldn't tie the
lookup of a SAS address to the SAS End Device but the sas_rphy, which
holds the address information.

Fixes: 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS enclosures')
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/scsi/scsi_transport_sas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 3f0ff07..6b6d7b0 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -390,9 +390,9 @@ EXPORT_SYMBOL(sas_remove_host);
  */
 u64 sas_get_address(struct scsi_device *sdev)
 {
-	struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+	struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);
 
-	return rdev->rphy.identify.sas_address;
+	return rphy->identify.sas_address;
 }
 EXPORT_SYMBOL(sas_get_address);
 
-- 
1.8.5.6

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address. Johannes Thumshirn <jthumshirn@suse.de> - 2016-08-11 10:00 +0200
  Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. James Bottomley <jejb@linux.vnet.ibm.com> - 2016-08-11 17:20 +0200
    Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. Johannes Thumshirn <jthumshirn@suse.de> - 2016-08-11 18:50 +0200
      Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. James Bottomley <jejb@linux.vnet.ibm.com> - 2016-08-11 20:10 +0200
        Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. Johannes Thumshirn <jthumshirn@suse.de> - 2016-08-12 12:10 +0200
          Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. Johannes Thumshirn <jthumshirn@suse.de> - 2016-08-12 15:20 +0200
            Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. James Bottomley <jejb@linux.vnet.ibm.com> - 2016-08-12 16:40 +0200
              Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. Hannes Reinecke <hare@suse.de> - 2016-08-12 16:50 +0200
                Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. James Bottomley <jejb@linux.vnet.ibm.com> - 2016-08-12 17:00 +0200
                Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain  address. Johannes Thumshirn <jthumshirn@suse.de> - 2016-08-12 17:00 +0200

csiph-web