linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume.
@ 2016-08-17  9:46 Johannes Thumshirn
  2016-08-17  9:46 ` [PATCH v4 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-17  9:46 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 v3:
* Fix phy vs. rphy typo in patch 1/3 (again).
  Verified with config from and cross build on Xtensa provided by 0day
  bot and below i386 randconfig and x86_64 SLES config.

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] 10+ messages in thread

* [PATCH v4 1/3] sas: provide stub implementation for scsi_is_sas_rphy
  2016-08-17  9:46 [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
@ 2016-08-17  9:46 ` Johannes Thumshirn
  2016-08-17  9:46 ` [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-17  9:46 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..31ae074 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)
@@ -202,7 +208,6 @@ extern int sas_rphy_add(struct sas_rphy *);
 extern void sas_rphy_remove(struct sas_rphy *);
 extern void sas_rphy_delete(struct sas_rphy *);
 extern void sas_rphy_unlink(struct sas_rphy *);
-extern int scsi_is_sas_rphy(const struct device *);
 
 struct sas_port *sas_port_alloc(struct device *, int);
 struct sas_port *sas_port_alloc_num(struct device *);
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-17  9:46 [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
  2016-08-17  9:46 ` [PATCH v4 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
@ 2016-08-17  9:46 ` Johannes Thumshirn
  2016-08-18 15:41   ` James Bottomley
  2016-08-22  8:57   ` kbuild test robot
  2016-08-17  9:46 ` [PATCH v4 3/3] sas: remove is_sas_attached() Johannes Thumshirn
  2016-08-19  2:24 ` [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Martin K. Petersen
  3 siblings, 2 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-17  9:46 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] 10+ messages in thread

* [PATCH v4 3/3] sas: remove is_sas_attached()
  2016-08-17  9:46 [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
  2016-08-17  9:46 ` [PATCH v4 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
  2016-08-17  9:46 ` [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
@ 2016-08-17  9:46 ` Johannes Thumshirn
  2016-08-19  2:24 ` [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Martin K. Petersen
  3 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-17  9:46 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 31ae074..73d8709 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] 10+ messages in thread

* Re: [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-17  9:46 ` [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
@ 2016-08-18 15:41   ` James Bottomley
  2016-08-18 16:08     ` James Bottomley
  2016-08-22  8:57   ` kbuild test robot
  1 sibling, 1 reply; 10+ messages in thread
From: James Bottomley @ 2016-08-18 15:41 UTC (permalink / raw)
  To: Johannes Thumshirn, Martin K . Petersen
  Cc: Hannes Reinecke, Linux Kernel Mailinglist,
	Linux SCSI Mailinglist, stable, #, v4.5+

On Wed, 2016-08-17 at 11:46 +0200, Johannes Thumshirn wrote:
> 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.

For the entire series:

Reviewed-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>

> Fixes: 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS
> enclosures')
> Cc: stable@vger.kernel.org # v4.5+

Except that we can't tag this for stable because without 1/3 it will
induce a compile failure within stable.  This means you're going to
have to do the stable process manually and submit both patches to
stable and explain the dependency, once they're upstream.

James

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-18 15:41   ` James Bottomley
@ 2016-08-18 16:08     ` James Bottomley
  2016-08-19  6:53       ` Johannes Thumshirn
  0 siblings, 1 reply; 10+ messages in thread
From: James Bottomley @ 2016-08-18 16:08 UTC (permalink / raw)
  To: Johannes Thumshirn, Martin K . Petersen
  Cc: Hannes Reinecke, Linux Kernel Mailinglist,
	Linux SCSI Mailinglist, stable

And please fix your scripts or just use the standard ones:

Cc: stable@vger.kernel.org, #@suse.de, v4.5+@suse.de,
  
I'm tired of getting two bounces every time I reply to this thread.

James

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume.
  2016-08-17  9:46 [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
                   ` (2 preceding siblings ...)
  2016-08-17  9:46 ` [PATCH v4 3/3] sas: remove is_sas_attached() Johannes Thumshirn
@ 2016-08-19  2:24 ` Martin K. Petersen
  3 siblings, 0 replies; 10+ messages in thread
From: Martin K. Petersen @ 2016-08-19  2:24 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: James Bottomley, Martin K . Petersen, Hannes Reinecke,
	Linux Kernel Mailinglist, Linux SCSI Mailinglist

>>>>> "Johannes" == Johannes Thumshirn <jthumshirn@suse.de> writes:

Johannes> The first patch provides stub implementations for
Johannes> scsi_is_sas_phy() and sas_get_address() for the case that
Johannes> CONFIG_SCSI_SAS_ATTRS is not defined.

Johannes> The second patch implements the actual fix in ses.c by
Johannes> changing the is_sas_attached() call to scsi_is_sas_rphy().

Johannes> The third and last patch removes is_sas_attached() as it
Johannes> doesn't have any more consumers left.

Applied to 4.8/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-18 16:08     ` James Bottomley
@ 2016-08-19  6:53       ` Johannes Thumshirn
  0 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-19  6:53 UTC (permalink / raw)
  To: James Bottomley
  Cc: Martin K . Petersen, Hannes Reinecke, Linux Kernel Mailinglist,
	Linux SCSI Mailinglist, stable

On Thu, Aug 18, 2016 at 09:08:42AM -0700, James Bottomley wrote:
> And please fix your scripts or just use the standard ones:

Hmmm, I'm not using a script at all but pure git send-email. I'll have
a look into it.

> 
> Cc: stable@vger.kernel.org, #@suse.de, v4.5+@suse.de,
>   
> I'm tired of getting two bounces every time I reply to this thread.
> 
> James
> 

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-17  9:46 ` [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
  2016-08-18 15:41   ` James Bottomley
@ 2016-08-22  8:57   ` kbuild test robot
  2016-08-24  7:22     ` Johannes Thumshirn
  1 sibling, 1 reply; 10+ messages in thread
From: kbuild test robot @ 2016-08-22  8:57 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: kbuild-all, James Bottomley, Martin K . Petersen,
	Hannes Reinecke, Linux Kernel Mailinglist,
	Linux SCSI Mailinglist, Johannes Thumshirn, stable, #, v4.5+

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Hi Johannes,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.8-rc3]
[cannot apply to next-20160822]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/Fix-panic-when-a-SES-device-is-attached-to-a-hpsa-logical-volume/20160815-231901
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-n0-08182202 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `ses_match_to_enclosure':
>> ses.c:(.text+0x548dae): undefined reference to `scsi_is_sas_rphy'

---
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: 27114 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached
  2016-08-22  8:57   ` kbuild test robot
@ 2016-08-24  7:22     ` Johannes Thumshirn
  0 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2016-08-24  7:22 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, James Bottomley, Martin K . Petersen,
	Hannes Reinecke, Linux Kernel Mailinglist,
	Linux SCSI Mailinglist, stable

On Mon, Aug 22, 2016 at 04:57:39PM +0800, kbuild test robot wrote:
> Hi Johannes,
> 
> [auto build test ERROR on scsi/for-next]
> [also build test ERROR on v4.8-rc3]
> [cannot apply to next-20160822]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> [Check https://git-scm.com/docs/git-format-patch for more information]
> 
> url:    https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/Fix-panic-when-a-SES-device-is-attached-to-a-hpsa-logical-volume/20160815-231901
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
> config: x86_64-randconfig-n0-08182202 (attached as .config)
> compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/built-in.o: In function `ses_match_to_enclosure':
> >> ses.c:(.text+0x548dae): undefined reference to `scsi_is_sas_rphy'

Sorry I was not able to reproduce this using the provided config
(neither with James' tree nor Martin's).

Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-08-24  7:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17  9:46 [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Johannes Thumshirn
2016-08-17  9:46 ` [PATCH v4 1/3] sas: provide stub implementation for scsi_is_sas_rphy Johannes Thumshirn
2016-08-17  9:46 ` [PATCH v4 2/3] ses: use scsi_is_sas_rphy instead of is_sas_attached Johannes Thumshirn
2016-08-18 15:41   ` James Bottomley
2016-08-18 16:08     ` James Bottomley
2016-08-19  6:53       ` Johannes Thumshirn
2016-08-22  8:57   ` kbuild test robot
2016-08-24  7:22     ` Johannes Thumshirn
2016-08-17  9:46 ` [PATCH v4 3/3] sas: remove is_sas_attached() Johannes Thumshirn
2016-08-19  2:24 ` [PATCH v4 0/3] Fix panic when a SES device is attached to a hpsa logical volume Martin K. Petersen

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).