[dm-devel] dm: dm_blk_ioctl(): implement failover for SG_IO on dm-multipath

Martin Wilck mwilck at suse.com
Thu Apr 29 08:33:09 UTC 2021


On Wed, 2021-04-28 at 15:54 -0400, Mike Snitzer wrote:
> 
> @@ -626,32 +626,16 @@ static int dm_sg_io_ioctl(struct block_device
> *bdev, fmode_t mode,
>                 }
>  
>                 if (rhdr.info & SG_INFO_CHECK) {
> -                       /*
> -                        * See if this is a target or path error.
> -                        * Compare blk_path_error(),
> scsi_result_to_blk_status(),
> -                        * blk_errors[].
> -                        */
> -                       switch (rhdr.host_status) {
> -                       case DID_OK:
> -                               if (scsi_status_is_good(rhdr.status))
> -                                       rc = 0;
> -                               break;
> -                       case DID_TARGET_FAILURE:
> -                               rc = -EREMOTEIO;
> -                               goto out;
> -                       case DID_NEXUS_FAILURE:
> -                               rc = -EBADE;
> -                               goto out;
> -                       case DID_ALLOC_FAILURE:
> -                               rc = -ENOSPC;
> -                               goto out;
> -                       case DID_MEDIUM_ERROR:
> -                               rc = -ENODATA;
> -                               goto out;
> -                       default:
> -                               /* Everything else is a path error */
> +                       blk_status_t sts =
> scsi_result_to_blk_status(rhdr.host_status, NULL);

This change makes dm_mod depend on scsi_mod. 
Would you seriously prefer that over a re-implementation of the logic?

Regards
Martin






More information about the dm-devel mailing list