Skip to content

Commit

Permalink
dm mpath: Use blk_path_error
Browse files Browse the repository at this point in the history
Uses common code for determining if an error should be retried on
alternate path.

Acked-by: Mike Snitzer <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Keith Busch authored and axboe committed Jan 10, 2018
1 parent e1f425e commit a127567
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,21 +1475,6 @@ static void activate_path_work(struct work_struct *work)
activate_or_offline_path(pgpath);
}

static int noretry_error(blk_status_t error)
{
switch (error) {
case BLK_STS_NOTSUPP:
case BLK_STS_NOSPC:
case BLK_STS_TARGET:
case BLK_STS_NEXUS:
case BLK_STS_MEDIUM:
return 1;
}

/* Anything else could be a path failure, so should be retried */
return 0;
}

static int multipath_end_io(struct dm_target *ti, struct request *clone,
blk_status_t error, union map_info *map_context)
{
Expand All @@ -1508,7 +1493,7 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
* request into dm core, which will remake a clone request and
* clone bios for it and resubmit it later.
*/
if (error && !noretry_error(error)) {
if (error && blk_path_error(error)) {
struct multipath *m = ti->private;

r = DM_ENDIO_REQUEUE;
Expand Down Expand Up @@ -1544,7 +1529,7 @@ static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone,
unsigned long flags;
int r = DM_ENDIO_DONE;

if (!*error || noretry_error(*error))
if (!*error || !blk_path_error(*error))
goto done;

if (pgpath)
Expand Down

0 comments on commit a127567

Please sign in to comment.