From: Alexander Duyck <aduyck@mirantis.com>
To: jbottomley@odin.com, hare@suse.de, linux-scsi@vger.kernel.org
Cc: alexander.duyck@gmail.com, martin.petersen@oracle.com,
	linux-kernel@vger.kernel.org, shane.seymour@hpe.com,
	jthumshirn@suse.de
Subject: [PATCH 1/2] scsi: Do not attach VPD to devices that don't support it
Date: Wed, 20 Jan 2016 22:35:22 -0800	[thread overview]
Message-ID: <20160121063522.3803.23150.stgit@localhost.localdomain> (raw)
In-Reply-To: <20160121063039.3803.66.stgit@localhost.localdomain>
The patch "scsi: rescan VPD attributes" introduced a regression in which
devices that don't support VPD were being scanned for VPD attributes
anyway.  This could cause issues for this parts and should be avoided so
the check for scsi_level has been moved out of scsi_add_lun and into
scsi_attach_vpd so that all callers will not scan VPD for devices that
don't support it.
Fixes: 09e2b0b14690 ("scsi: rescan VPD attributes")
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
 drivers/scsi/scsi.c      |    3 +++
 drivers/scsi/scsi_scan.c |    3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index b1bf42b93fcc..ed085e78c893 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -784,6 +784,9 @@ void scsi_attach_vpd(struct scsi_device *sdev)
 	int pg83_supported = 0;
 	unsigned char __rcu *vpd_buf, *orig_vpd_buf = NULL;
 
+	if (sdev->scsi_level < SCSI_3)
+		return;
+
 	if (sdev->skip_vpd_pages)
 		return;
 retry_pg0:
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 6a820668d442..1b16c89e0cf9 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -986,8 +986,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 		}
 	}
 
-	if (sdev->scsi_level >= SCSI_3)
-		scsi_attach_vpd(sdev);
+	scsi_attach_vpd(sdev);
 
 	sdev->max_queue_depth = sdev->queue_depth;
 
next prev parent reply	other threads:[~2016-01-21  6:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21  6:35 [PATCH 0/2] scsi: Fix endless loop of ATA hard resets due to VPD reads Alexander Duyck
2016-01-21  6:35 ` Alexander Duyck [this message]
2016-01-21  7:37   ` [PATCH 1/2] scsi: Do not attach VPD to devices that don't support it Hannes Reinecke
2016-01-21 17:05     ` Alexander Duyck
2016-02-02  1:22     ` Martin K. Petersen
2016-01-21  6:35 ` [PATCH 2/2] scsi: Fix RCU handling for VPD pages Alexander Duyck
2016-01-21  7:40   ` Hannes Reinecke
2016-02-02 10:18 ` [PATCH 0/2] scsi: Fix endless loop of ATA hard resets due to VPD reads Kirill A. Shutemov
2016-02-03  2:45   ` Martin K. Petersen
2016-02-03  6:48     ` Kirill A. Shutemov
2016-02-03 15:27       ` Alexander Duyck
2016-02-04  2:39       ` Martin K. Petersen
2016-02-05 14:54   ` Todd Fujinaka
2016-02-10  2:09     ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2016-04-01  6:57 [PATCH 0/2] scsi: vpd sanity checks Hannes Reinecke
2016-04-01  6:57 ` [PATCH 1/2] scsi: Do not attach VPD to devices that don't support it Hannes Reinecke
2016-04-01  7:44   ` Johannes Thumshirn
2016-04-04 23:12   ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20160121063522.3803.23150.stgit@localhost.localdomain \
    --to=aduyck@mirantis.com \
    --cc=alexander.duyck@gmail.com \
    --cc=hare@suse.de \
    --cc=jbottomley@odin.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=shane.seymour@hpe.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).