* [PATCH v3 0/3] Fix panic when a SES device is attached to a hpsa logical volume.
@ 2016-08-17 8:40 Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-08-17 8:40 UTC (permalink / raw)
To: James Bottomley, Martin K . Petersen
Cc: Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn
The first patch provides stub implementations for scsi_is_sas_phy()
and sas_get_address() for the case that CONFIG_SCSI_SAS_ATTRS is not
defined.
The second patch implements the actual fix in ses.c by changing the
is_sas_attached() call to scsi_is_sas_rphy().
The third and last patch removes is_sas_attached() as it doesn't have
any more consumers left.
Changes from v2:
* Fix phy vs. rphy typo in patch 1/3.
Verified with config from http://www.spinics.net/lists/linux-scsi/msg99067.html
Johannes Thumshirn (3):
sas: provide stub implementation for scsi_is_sas_rphy
ses: use scsi_is_sas_rphy instead of is_sas_attached
sas: remove is_sas_attached()
drivers/scsi/scsi_transport_sas.c | 16 ----------------
drivers/scsi/ses.c | 2 +-
include/scsi/scsi_transport_sas.h | 5 ++---
3 files changed, 3 insertions(+), 20 deletions(-)
--
1.8.5.6
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy
2016-08-17 8:40 [PATCH v3 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
@ 2016-08-17 8:40 ` Johannes Thumshirn
2016-08-17 9:19 ` kbuild test robot
2016-08-17 9:56 ` kbuild test robot
2016-08-17 8:40 ` [PATCH v3 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 3/3] sas: remove is_sas_attached() Johannes Thumshirn
2 siblings, 2 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-08-17 8:40 UTC (permalink / raw)
To: James Bottomley, Martin K . Petersen
Cc: Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn
Provide a stub implementation for scsi_is_sas_rphy for kernel
configurations which do not have CONFIG_SCSI_SAS_ATTRS defined.
Reported-by: kbuild test robot <lkp@intel.com>
Suggested-by: James Bottomley <jejb@linux.vnet.ibm.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
include/scsi/scsi_transport_sas.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 13c0b2b..8d0d2fb 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -15,8 +15,14 @@ static inline int is_sas_attached(struct scsi_device *sdev)
{
return 0;
}
+
+static inline int scsi_is_sas_rphy(const struct device *sdev)
+{
+ return 0;
+}
#else
extern int is_sas_attached(struct scsi_device *sdev);
+extern int scsi_is_sas_rphy(const struct device *);
#endif
static inline int sas_protocol_ata(enum sas_protocol proto)
@@ -187,7 +193,6 @@ extern struct sas_phy *sas_phy_alloc(struct device *, int);
extern void sas_phy_free(struct sas_phy *);
extern int sas_phy_add(struct sas_phy *);
extern void sas_phy_delete(struct sas_phy *);
-extern int scsi_is_sas_phy(const struct device *);
u64 sas_get_address(struct scsi_device *);
unsigned int sas_tlr_supported(struct scsi_device *);
--
1.8.5.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
2016-08-17 8:40 [PATCH v3 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
@ 2016-08-17 8:40 ` Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 3/3] sas: remove is_sas_attached() Johannes Thumshirn
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-08-17 8:40 UTC (permalink / raw)
To: James Bottomley, Martin K . Petersen
Cc: Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn, stable, #, v4.5+
Use scsi_is_sas_rphy() instead of is_sas_attached() to decide whether
we should obtain the SAS address from a scsi device or not. This will
prevent us from tripping on the BUG_ON() in sas_sdev_to_rdev() if the
rphy isn't attached to the SAS transport class, like it is with hpsa's
logical devices.
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/ses.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 53ef1cb6..1d82053 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -587,7 +587,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
- if (is_sas_attached(sdev))
+ if (scsi_is_sas_rphy(&sdev->sdev_gendev))
efd.addr = sas_get_address(sdev);
if (efd.addr) {
--
1.8.5.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] sas: remove is_sas_attached()
2016-08-17 8:40 [PATCH v3 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
@ 2016-08-17 8:40 ` Johannes Thumshirn
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-08-17 8:40 UTC (permalink / raw)
To: James Bottomley, Martin K . Petersen
Cc: Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn
As there are no more users of is_sas_attached() left, remove it.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/scsi/scsi_transport_sas.c | 16 ----------------
include/scsi/scsi_transport_sas.h | 6 ------
2 files changed, 22 deletions(-)
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 3f0ff07..60b651b 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -341,22 +341,6 @@ static int do_sas_phy_delete(struct device *dev, void *data)
}
/**
- * is_sas_attached - check if device is SAS attached
- * @sdev: scsi device to check
- *
- * returns true if the device is SAS attached
- */
-int is_sas_attached(struct scsi_device *sdev)
-{
- struct Scsi_Host *shost = sdev->host;
-
- return shost->transportt->host_attrs.ac.class ==
- &sas_host_class.class;
-}
-EXPORT_SYMBOL(is_sas_attached);
-
-
-/**
* sas_remove_children - tear down a devices SAS data structures
* @dev: device belonging to the sas object
*
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 8d0d2fb..4d287cb 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -11,17 +11,11 @@ struct sas_rphy;
struct request;
#if !IS_ENABLED(CONFIG_SCSI_SAS_ATTRS)
-static inline int is_sas_attached(struct scsi_device *sdev)
-{
- return 0;
-}
-
static inline int scsi_is_sas_rphy(const struct device *sdev)
{
return 0;
}
#else
-extern int is_sas_attached(struct scsi_device *sdev);
extern int scsi_is_sas_rphy(const struct device *);
#endif
--
1.8.5.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
@ 2016-08-17 9:19 ` kbuild test robot
2016-08-17 9:56 ` kbuild test robot
1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-08-17 9:19 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: kbuild-all, James Bottomley, Martin K . Petersen,
Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn
[-- Attachment #1: Type: text/plain, Size: 2350 bytes --]
Hi Johannes,
[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.8-rc2 next-20160817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/Fix-panic-when-a-SES-device-is-attached-to-a-hpsa-logical-volume/20160817-165528
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/scsi/scsi_transport_sas.c: In function 'do_sas_phy_delete':
>> drivers/scsi/scsi_transport_sas.c:338:2: error: implicit declaration of function 'scsi_is_sas_phy' [-Werror=implicit-function-declaration]
else if (pass == 1 && scsi_is_sas_phy(dev))
^
cc1: some warnings being treated as errors
vim +/scsi_is_sas_phy +338 drivers/scsi/scsi_transport_sas.c
c7ebbbce Christoph Hellwig 2005-09-09 332 static int do_sas_phy_delete(struct device *dev, void *data)
c7ebbbce Christoph Hellwig 2005-09-09 333 {
65c92b09 James Bottomley 2006-06-28 334 int pass = (int)(unsigned long)data;
65c92b09 James Bottomley 2006-06-28 335
65c92b09 James Bottomley 2006-06-28 336 if (pass == 0 && scsi_is_sas_port(dev))
65c92b09 James Bottomley 2006-06-28 337 sas_port_delete(dev_to_sas_port(dev));
65c92b09 James Bottomley 2006-06-28 @338 else if (pass == 1 && scsi_is_sas_phy(dev))
c7ebbbce Christoph Hellwig 2005-09-09 339 sas_phy_delete(dev_to_phy(dev));
c7ebbbce Christoph Hellwig 2005-09-09 340 return 0;
c7ebbbce Christoph Hellwig 2005-09-09 341 }
:::::: The code at line 338 was first introduced by commit
:::::: 65c92b09acf0218b64f1c7ba4fdabeb8b732c876 [SCSI] scsi_transport_sas: introduce a sas_port entity
:::::: TO: James Bottomley <James.Bottomley@steeleye.com>
:::::: CC: James Bottomley <jejb@mulgrave.il.steeleye.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 46028 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
2016-08-17 9:19 ` kbuild test robot
@ 2016-08-17 9:56 ` kbuild test robot
1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-08-17 9:56 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: kbuild-all, James Bottomley, Martin K . Petersen,
Hannes Reinecke, Linux Kernel Mailinglist,
Linux SCSI Mailinglist, Johannes Thumshirn
[-- Attachment #1: Type: text/plain, Size: 3605 bytes --]
Hi Johannes,
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.8-rc2 next-20160817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/Fix-panic-when-a-SES-device-is-attached-to-a-hpsa-logical-volume/20160817-165528
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-x009-201633 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/init.h:4:0,
from drivers/scsi/scsi_transport_sas.c:26:
drivers/scsi/scsi_transport_sas.c: In function 'do_sas_phy_delete':
drivers/scsi/scsi_transport_sas.c:338:24: error: implicit declaration of function 'scsi_is_sas_phy' [-Werror=implicit-function-declaration]
else if (pass == 1 && scsi_is_sas_phy(dev))
^
include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers/scsi/scsi_transport_sas.c:338:7: note: in expansion of macro 'if'
else if (pass == 1 && scsi_is_sas_phy(dev))
^~
cc1: some warnings being treated as errors
vim +/if +338 drivers/scsi/scsi_transport_sas.c
c7ebbbce Christoph Hellwig 2005-09-09 322 if (!shost->transportt)
c7ebbbce Christoph Hellwig 2005-09-09 323 return 0;
c7ebbbce Christoph Hellwig 2005-09-09 324 if (shost->transportt->host_attrs.ac.class !=
c7ebbbce Christoph Hellwig 2005-09-09 325 &sas_host_class.class)
c7ebbbce Christoph Hellwig 2005-09-09 326 return 0;
c7ebbbce Christoph Hellwig 2005-09-09 327
c7ebbbce Christoph Hellwig 2005-09-09 328 i = to_sas_internal(shost->transportt);
c7ebbbce Christoph Hellwig 2005-09-09 329 return &i->t.host_attrs.ac == cont;
c7ebbbce Christoph Hellwig 2005-09-09 330 }
c7ebbbce Christoph Hellwig 2005-09-09 331
c7ebbbce Christoph Hellwig 2005-09-09 332 static int do_sas_phy_delete(struct device *dev, void *data)
c7ebbbce Christoph Hellwig 2005-09-09 333 {
65c92b09 James Bottomley 2006-06-28 334 int pass = (int)(unsigned long)data;
65c92b09 James Bottomley 2006-06-28 335
65c92b09 James Bottomley 2006-06-28 336 if (pass == 0 && scsi_is_sas_port(dev))
65c92b09 James Bottomley 2006-06-28 337 sas_port_delete(dev_to_sas_port(dev));
65c92b09 James Bottomley 2006-06-28 @338 else if (pass == 1 && scsi_is_sas_phy(dev))
c7ebbbce Christoph Hellwig 2005-09-09 339 sas_phy_delete(dev_to_phy(dev));
c7ebbbce Christoph Hellwig 2005-09-09 340 return 0;
c7ebbbce Christoph Hellwig 2005-09-09 341 }
c7ebbbce Christoph Hellwig 2005-09-09 342
c7ebbbce Christoph Hellwig 2005-09-09 343 /**
3b91d09c James Bottomley 2015-12-09 344 * is_sas_attached - check if device is SAS attached
3b91d09c James Bottomley 2015-12-09 345 * @sdev: scsi device to check
3b91d09c James Bottomley 2015-12-09 346 *
:::::: The code at line 338 was first introduced by commit
:::::: 65c92b09acf0218b64f1c7ba4fdabeb8b732c876 [SCSI] scsi_transport_sas: introduce a sas_port entity
:::::: TO: James Bottomley <James.Bottomley@steeleye.com>
:::::: CC: James Bottomley <jejb@mulgrave.il.steeleye.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 27190 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-17 9:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 8:40 [PATCH v3 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
2016-08-17 9:19 ` kbuild test robot
2016-08-17 9:56 ` kbuild test robot
2016-08-17 8:40 ` [PATCH v3 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
2016-08-17 8:40 ` [PATCH v3 3/3] sas: remove is_sas_attached() Johannes Thumshirn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).