summaryrefslogtreecommitdiff
path: root/drivers/md/dm-mpath.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 10:34:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 10:34:03 -0700
commit7b66f13207e60e7c550af730986e77e38a0c69a3 (patch)
treec2dad63d3ef3513a6656b39fb3ed0f974a6fff97 /drivers/md/dm-mpath.c
parentd35a878ae1c50977b55e352fd46e36e35add72a0 (diff)
parent412445acb6cad4cef026daae37c4765fb9942c60 (diff)
Merge tag 'for-4.12/dm-post-merge-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull additional device mapper updates from Mike Snitzer: "Here are some changes from Christoph that needed to be rebased ontop of changes that were already merged into the device mapper tree. In addition, these changes depend on the 'for-4.12/block' changes that you've already merged. - Cleanups to request-based DM and DM multipath from Christoph that prepare for his block core error code type checking improvements" * tag 'for-4.12/dm-post-merge-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: introduce a new DM_MAPIO_KILL return value dm rq: change ->rq_end_io calling conventions dm mpath: merge do_end_io into multipath_end_io
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r--drivers/md/dm-mpath.c54
1 files changed, 21 insertions, 33 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 52cd3f1608b3..926a6bcb32c8 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1464,12 +1464,13 @@ static int noretry_error(int error)
return 0;
}
-/*
- * end_io handling
- */
-static int do_end_io(struct multipath *m, struct request *clone,
- int error, struct dm_mpath_io *mpio)
+static int multipath_end_io(struct dm_target *ti, struct request *clone,
+ int error, union map_info *map_context)
{
+ struct dm_mpath_io *mpio = get_mpio(map_context);
+ struct pgpath *pgpath = mpio->pgpath;
+ int r = DM_ENDIO_DONE;
+
/*
* We don't queue any clone request inside the multipath target
* during end I/O handling, since those clone requests don't have
@@ -1481,39 +1482,26 @@ static int do_end_io(struct multipath *m, struct request *clone,
* request into dm core, which will remake a clone request and
* clone bios for it and resubmit it later.
*/
- int r = DM_ENDIO_REQUEUE;
-
- if (!error)
- return 0; /* I/O complete */
+ if (error && !noretry_error(error)) {
+ struct multipath *m = ti->private;
- if (noretry_error(error))
- return error;
-
- if (mpio->pgpath)
- fail_path(mpio->pgpath);
+ r = DM_ENDIO_REQUEUE;
- if (atomic_read(&m->nr_valid_paths) == 0 &&
- !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
- r = dm_report_EIO(m);
-
- return r;
-}
-
-static int multipath_end_io(struct dm_target *ti, struct request *clone,
- int error, union map_info *map_context)
-{
- struct multipath *m = ti->private;
- struct dm_mpath_io *mpio = get_mpio(map_context);
- struct pgpath *pgpath;
- struct path_selector *ps;
- int r;
+ if (pgpath)
+ fail_path(pgpath);
- BUG_ON(!mpio);
+ if (atomic_read(&m->nr_valid_paths) == 0 &&
+ !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) {
+ if (error == -EIO)
+ error = dm_report_EIO(m);
+ /* complete with the original error */
+ r = DM_ENDIO_DONE;
+ }
+ }
- r = do_end_io(m, clone, error, mpio);
- pgpath = mpio->pgpath;
if (pgpath) {
- ps = &pgpath->pg->ps;
+ struct path_selector *ps = &pgpath->pg->ps;
+
if (ps->type->end_io)
ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
}