aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-04-27 13:11:26 -0400
committerMike Snitzer <snitzer@redhat.com>2017-04-27 17:08:47 -0400
commit86331f39a5935b092d3ea59446d416563ed05d16 (patch)
tree15eaf3fedb3bfd6252b7125e8d5c29daa71163b8
parent9a8ac3ae682e8760afebab71556a9a8d1b18f906 (diff)
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: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-mpath.c25
-rw-r--r--drivers/md/dm.c2
2 files changed, 23 insertions, 4 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index cc529537c8ce..fd7cdc4ce2a5 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -442,6 +442,23 @@ failed:
442} 442}
443 443
444/* 444/*
445 * dm_report_EIO() is a macro instead of a function to make pr_debug()
446 * report the function name and line number of the function from which
447 * it has been invoked.
448 */
449#define dm_report_EIO(m) \
450({ \
451 struct mapped_device *md = dm_table_get_md((m)->ti->table); \
452 \
453 pr_debug("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d\n", \
454 dm_device_name(md), \
455 test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \
456 test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \
457 dm_noflush_suspending((m)->ti)); \
458 -EIO; \
459})
460
461/*
445 * Map cloned requests (request-based multipath) 462 * Map cloned requests (request-based multipath)
446 */ 463 */
447static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, 464static 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,
464 if (!pgpath) { 481 if (!pgpath) {
465 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 482 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
466 return DM_MAPIO_DELAY_REQUEUE; 483 return DM_MAPIO_DELAY_REQUEUE;
467 return -EIO; /* Failed */ 484 return dm_report_EIO(m); /* Failed */
468 } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || 485 } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) ||
469 test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { 486 test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) {
470 if (pg_init_all_paths(m)) 487 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 if (!pgpath) { 558 if (!pgpath) {
542 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 559 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
543 return DM_MAPIO_REQUEUE; 560 return DM_MAPIO_REQUEUE;
544 return -EIO; 561 return dm_report_EIO(m);
545 } 562 }
546 563
547 mpio->pgpath = pgpath; 564 mpio->pgpath = pgpath;
@@ -1476,7 +1493,7 @@ static int do_end_io(struct multipath *m, struct request *clone,
1476 1493
1477 if (atomic_read(&m->nr_valid_paths) == 0 && 1494 if (atomic_read(&m->nr_valid_paths) == 0 &&
1478 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1495 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
1479 r = -EIO; 1496 r = dm_report_EIO(m);
1480 1497
1481 return r; 1498 return r;
1482} 1499}
@@ -1519,7 +1536,7 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone,
1519 1536
1520 if (atomic_read(&m->nr_valid_paths) == 0 && 1537 if (atomic_read(&m->nr_valid_paths) == 0 &&
1521 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1538 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
1522 return -EIO; 1539 return dm_report_EIO(m);
1523 1540
1524 /* Queue for the daemon to resubmit */ 1541 /* Queue for the daemon to resubmit */
1525 dm_bio_restore(get_bio_details_from_bio(clone), clone); 1542 dm_bio_restore(get_bio_details_from_bio(clone), clone);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 45660246e8f5..dbfaf6dde657 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2169,6 +2169,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map,
2169 */ 2169 */
2170 if (noflush) 2170 if (noflush)
2171 set_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); 2171 set_bit(DMF_NOFLUSH_SUSPENDING, &md->flags);
2172 else
2173 pr_debug("%s: suspending with flush\n", dm_device_name(md));
2172 2174
2173 /* 2175 /*
2174 * This gets reverted if there's an error later and the targets 2176 * This gets reverted if there's an error later and the targets