Commit 2930f817 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: scsi_dh: suppress errors from unsupported devices

Device handlers are optional, and for some handlers like ALUA only
implemented for certain device types.  So suppress any errors for
unsupported devices.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2a8f7a03
...@@ -140,12 +140,17 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev, ...@@ -140,12 +140,17 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,
case SCSI_DH_RES_TEMP_UNAVAIL: case SCSI_DH_RES_TEMP_UNAVAIL:
ret = -EAGAIN; ret = -EAGAIN;
break; break;
case SCSI_DH_DEV_UNSUPP:
case SCSI_DH_NOSYS:
ret = -ENODEV;
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n", if (ret != -ENODEV)
scsi_dh->name, error); sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
scsi_dh->name, error);
module_put(scsi_dh->module); module_put(scsi_dh->module);
} else } else
sdev->handler = scsi_dh; sdev->handler = scsi_dh;
...@@ -164,18 +169,20 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev) ...@@ -164,18 +169,20 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev)
module_put(sdev->handler->module); module_put(sdev->handler->module);
} }
int scsi_dh_add_device(struct scsi_device *sdev) void scsi_dh_add_device(struct scsi_device *sdev)
{ {
struct scsi_device_handler *devinfo = NULL; struct scsi_device_handler *devinfo = NULL;
const char *drv; const char *drv;
int err = 0;
drv = scsi_dh_find_driver(sdev); drv = scsi_dh_find_driver(sdev);
if (drv) if (drv)
devinfo = __scsi_dh_lookup(drv); devinfo = __scsi_dh_lookup(drv);
/*
* device_handler is optional, so ignore errors
* from scsi_dh_handler_attach()
*/
if (devinfo) if (devinfo)
err = scsi_dh_handler_attach(sdev, devinfo); (void)scsi_dh_handler_attach(sdev, devinfo);
return err;
} }
void scsi_dh_release_device(struct scsi_device *sdev) void scsi_dh_release_device(struct scsi_device *sdev)
......
...@@ -176,10 +176,10 @@ extern struct async_domain scsi_sd_probe_domain; ...@@ -176,10 +176,10 @@ extern struct async_domain scsi_sd_probe_domain;
/* scsi_dh.c */ /* scsi_dh.c */
#ifdef CONFIG_SCSI_DH #ifdef CONFIG_SCSI_DH
int scsi_dh_add_device(struct scsi_device *sdev); void scsi_dh_add_device(struct scsi_device *sdev);
void scsi_dh_release_device(struct scsi_device *sdev); void scsi_dh_release_device(struct scsi_device *sdev);
#else #else
static inline int scsi_dh_add_device(struct scsi_device *sdev) { return 0; } static inline void scsi_dh_add_device(struct scsi_device *sdev) { }
static inline void scsi_dh_release_device(struct scsi_device *sdev) { } static inline void scsi_dh_release_device(struct scsi_device *sdev) { }
#endif #endif
static inline void scsi_dh_remove_device(struct scsi_device *sdev) { } static inline void scsi_dh_remove_device(struct scsi_device *sdev) { }
......
...@@ -1234,13 +1234,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) ...@@ -1234,13 +1234,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
scsi_autopm_get_device(sdev); scsi_autopm_get_device(sdev);
error = scsi_dh_add_device(sdev); 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);
error = device_add(&sdev->sdev_gendev); error = device_add(&sdev->sdev_gendev);
if (error) { if (error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment