Thread (9 messages) 9 messages, 4 authors, 2021-05-03

Re: dm: dm_blk_ioctl(): implement failover for SG_IO on dm-multipath

From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-04-29 08:39:53
Also in: dm-devel, linux-scsi

On 29/04/21 10:33, Martin Wilck wrote:
On Wed, 2021-04-28 at 15:54 -0400, Mike Snitzer wrote:
quoted
@@ -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?
You could just make it an inline function too.

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help