Skip to contentSkip to conversation

scsi_dh_alua: suppress errors from unsupported devices

PATCH Superseded Hannes Reinecke 4 participants 5 messages Aug 4, 2017 – Aug 7, 2017 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_dh_alua: suppress errors from unsupported devices

ALUA is only relevant for disk-like devices, so we shouldn't be printing out warning messages for other device types.

---
 drivers/scsi/device_handler/scsi_dh_alua.c | 2 ++
 drivers/scsi/scsi_dh.c                     | 5 +++--
 drivers/scsi/scsi_sysfs.c                  | 7 +------
 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +2 -0
index 0962fd5..c3aea06 100644
@@ -1100,6 +1100,8 @@ static int alua_bus_attach(struct scsi_device *sdev)
 	err = alua_initialize(sdev, h);
 	if (err == SCSI_DH_NOMEM)
 		ret = -ENOMEM;
+	if (err == SCSI_DH_DEV_UNSUPP)
+		ret = -ENODEV;
 	if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED)
 		goto failed;
 
drivers/scsi/scsi_dh.c +3 -2
index 84addee..16e780d 100644
@@ -133,8 +133,9 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,
 
 	error = scsi_dh->attach(sdev);
 	if (error) {
-		sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
-			    scsi_dh->name, error);
+		if (error != -ENODEV)
+			sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
+				    scsi_dh->name, error);
 		module_put(scsi_dh->module);
 	} else
 		sdev->handler = scsi_dh;
drivers/scsi/scsi_sysfs.c +1 -6
index d6984df..5e8ace2 100644
@@ -1222,12 +1222,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 	scsi_autopm_get_device(sdev);
 
 	error = scsi_dh_add_device(sdev);
-	if (error)
-		/*
-		 * device_handler is optional, so any error can be ignored
-		 */
-		sdev_printk(KERN_INFO, sdev,
-				"failed to add device handler: %d\n", error);
+	/* device_handler is optional, so any error can be ignored */
 
 	error = device_add(&sdev->sdev_gendev);
 	if (error) {
Signature · 1 line
1.8.5.6
#3 lore raw
In reply to Hannes Reinecke

drivers/scsi/scsi_sysfs.c int scsi_sysfs_add_sdev(struct scsi_device *sdev) · line 1225

Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1 -6
 	error = scsi_dh_add_device(sdev);
-	if (error)
-		/*
-		 * device_handler is optional, so any error can be ignored
-		 */
-		sdev_printk(KERN_INFO, sdev,
-				"failed to add device handler: %d\n", error);
+	/* device_handler is optional, so any error can be ignored */

In that case it should return void.

#4 lore raw
Quoted 11 lines · Christoph Hellwig

drivers/scsi/scsi_sysfs.c int scsi_sysfs_add_sdev(struct scsi_device *sdev) · line 1225

Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1 -6
 	error = scsi_dh_add_device(sdev);
-	if (error)
-		/*
-		 * device_handler is optional, so any error can be ignored
-		 */
-		sdev_printk(KERN_INFO, sdev,
-				"failed to add device handler: %d\n", error);
+	/* device_handler is optional, so any error can be ignored */

In that case it should return void.

Okay, will be updating the patch.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)