Commit 86331f39 authored by Bart Van Assche's avatar Bart Van Assche Committed by Mike Snitzer

dm mpath: make it easier to detect unintended I/O request flushes

I/O errors triggered by multipathd incorrectly not enabling the no-flush
flag for DM_DEVICE_SUSPEND or DM_DEVICE_RESUME are hard to debug.  Add
more logging to make it easier to debug this.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 9a8ac3ae
...@@ -441,6 +441,23 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) ...@@ -441,6 +441,23 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
return NULL; return NULL;
} }
/*
* dm_report_EIO() is a macro instead of a function to make pr_debug()
* report the function name and line number of the function from which
* it has been invoked.
*/
#define dm_report_EIO(m) \
({ \
struct mapped_device *md = dm_table_get_md((m)->ti->table); \
\
pr_debug("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d\n", \
dm_device_name(md), \
test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \
test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \
dm_noflush_suspending((m)->ti)); \
-EIO; \
})
/* /*
* Map cloned requests (request-based multipath) * Map cloned requests (request-based multipath)
*/ */
...@@ -464,7 +481,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, ...@@ -464,7 +481,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
if (!pgpath) { if (!pgpath) {
if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
return DM_MAPIO_DELAY_REQUEUE; return DM_MAPIO_DELAY_REQUEUE;
return -EIO; /* Failed */ return dm_report_EIO(m); /* Failed */
} else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) ||
test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) {
if (pg_init_all_paths(m)) if (pg_init_all_paths(m))
...@@ -541,7 +558,7 @@ static int __multipath_map_bio(struct multipath *m, struct bio *bio, struct dm_m ...@@ -541,7 +558,7 @@ static int __multipath_map_bio(struct multipath *m, struct bio *bio, struct dm_m
if (!pgpath) { if (!pgpath) {
if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
return DM_MAPIO_REQUEUE; return DM_MAPIO_REQUEUE;
return -EIO; return dm_report_EIO(m);
} }
mpio->pgpath = pgpath; mpio->pgpath = pgpath;
...@@ -1476,7 +1493,7 @@ static int do_end_io(struct multipath *m, struct request *clone, ...@@ -1476,7 +1493,7 @@ static int do_end_io(struct multipath *m, struct request *clone,
if (atomic_read(&m->nr_valid_paths) == 0 && if (atomic_read(&m->nr_valid_paths) == 0 &&
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
r = -EIO; r = dm_report_EIO(m);
return r; return r;
} }
...@@ -1519,7 +1536,7 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone, ...@@ -1519,7 +1536,7 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone,
if (atomic_read(&m->nr_valid_paths) == 0 && if (atomic_read(&m->nr_valid_paths) == 0 &&
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
return -EIO; return dm_report_EIO(m);
/* Queue for the daemon to resubmit */ /* Queue for the daemon to resubmit */
dm_bio_restore(get_bio_details_from_bio(clone), clone); dm_bio_restore(get_bio_details_from_bio(clone), clone);
......
...@@ -2169,6 +2169,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, ...@@ -2169,6 +2169,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map,
*/ */
if (noflush) if (noflush)
set_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); set_bit(DMF_NOFLUSH_SUSPENDING, &md->flags);
else
pr_debug("%s: suspending with flush\n", dm_device_name(md));
/* /*
* This gets reverted if there's an error later and the targets * This gets reverted if there's an error later and the targets
......
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