aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-31 21:39:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-31 21:39:19 -0400
commit73adb8c5b0ea15e3942ab5781eb3e72d4e028ada (patch)
tree22b5a5fe9de93aeca678d973dc9b6de8c7f7eb34
parent1b2614f1dd687d79d413cf34f69b003bbe385709 (diff)
parent1c23484c355ec360ca2f37914f8a4802c6baeead (diff)
Merge tag 'for-4.13/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: - A couple fixes for bugs introduced as part of the blk_status_t block layer changes during the 4.13 merge window - A printk throttling fix to use discrete rate limiting state for each DM log level - A stable@ fix for DM multipath that delays request requeueing to avoid CPU lockup if/when the request queue is "dying" * tag 'for-4.13/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm mpath: do not lock up a CPU with requeuing activity dm: fix printk() rate limiting code dm mpath: retry BLK_STS_RESOURCE errors dm: fix the second dec_pending() argument in __split_and_process_bio()
-rw-r--r--drivers/md/dm-mpath.c2
-rw-r--r--drivers/md/dm.c12
-rw-r--r--include/linux/device-mapper.h41
3 files changed, 13 insertions, 42 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 0e8ab5bb3575..d24e4b05f5da 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -504,7 +504,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
504 if (queue_dying) { 504 if (queue_dying) {
505 atomic_inc(&m->pg_init_in_progress); 505 atomic_inc(&m->pg_init_in_progress);
506 activate_or_offline_path(pgpath); 506 activate_or_offline_path(pgpath);
507 return DM_MAPIO_REQUEUE;
508 } 507 }
509 return DM_MAPIO_DELAY_REQUEUE; 508 return DM_MAPIO_DELAY_REQUEUE;
510 } 509 }
@@ -1458,7 +1457,6 @@ static int noretry_error(blk_status_t error)
1458 case BLK_STS_TARGET: 1457 case BLK_STS_TARGET:
1459 case BLK_STS_NEXUS: 1458 case BLK_STS_NEXUS:
1460 case BLK_STS_MEDIUM: 1459 case BLK_STS_MEDIUM:
1461 case BLK_STS_RESOURCE:
1462 return 1; 1460 return 1;
1463 } 1461 }
1464 1462
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2edbcc2d7d3f..d669fddd9290 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -27,16 +27,6 @@
27 27
28#define DM_MSG_PREFIX "core" 28#define DM_MSG_PREFIX "core"
29 29
30#ifdef CONFIG_PRINTK
31/*
32 * ratelimit state to be used in DMXXX_LIMIT().
33 */
34DEFINE_RATELIMIT_STATE(dm_ratelimit_state,
35 DEFAULT_RATELIMIT_INTERVAL,
36 DEFAULT_RATELIMIT_BURST);
37EXPORT_SYMBOL(dm_ratelimit_state);
38#endif
39
40/* 30/*
41 * Cookies are numeric values sent with CHANGE and REMOVE 31 * Cookies are numeric values sent with CHANGE and REMOVE
42 * uevents while resuming, removing or renaming the device. 32 * uevents while resuming, removing or renaming the device.
@@ -1523,7 +1513,7 @@ static void __split_and_process_bio(struct mapped_device *md,
1523 } 1513 }
1524 1514
1525 /* drop the extra reference count */ 1515 /* drop the extra reference count */
1526 dec_pending(ci.io, error); 1516 dec_pending(ci.io, errno_to_blk_status(error));
1527} 1517}
1528/*----------------------------------------------------------------- 1518/*-----------------------------------------------------------------
1529 * CRUD END 1519 * CRUD END
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 1473455d0341..4f2b3b2076c4 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -549,46 +549,29 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
549 *---------------------------------------------------------------*/ 549 *---------------------------------------------------------------*/
550#define DM_NAME "device-mapper" 550#define DM_NAME "device-mapper"
551 551
552#ifdef CONFIG_PRINTK 552#define DM_RATELIMIT(pr_func, fmt, ...) \
553extern struct ratelimit_state dm_ratelimit_state; 553do { \
554 554 static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, \
555#define dm_ratelimit() __ratelimit(&dm_ratelimit_state) 555 DEFAULT_RATELIMIT_BURST); \
556#else 556 \
557#define dm_ratelimit() 0 557 if (__ratelimit(&rs)) \
558#endif 558 pr_func(DM_FMT(fmt), ##__VA_ARGS__); \
559} while (0)
559 560
560#define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" 561#define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n"
561 562
562#define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) 563#define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__)
563 564
564#define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) 565#define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
565#define DMERR_LIMIT(fmt, ...) \ 566#define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__)
566do { \
567 if (dm_ratelimit()) \
568 DMERR(fmt, ##__VA_ARGS__); \
569} while (0)
570
571#define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) 567#define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__)
572#define DMWARN_LIMIT(fmt, ...) \ 568#define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__)
573do { \
574 if (dm_ratelimit()) \
575 DMWARN(fmt, ##__VA_ARGS__); \
576} while (0)
577
578#define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) 569#define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
579#define DMINFO_LIMIT(fmt, ...) \ 570#define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__)
580do { \
581 if (dm_ratelimit()) \
582 DMINFO(fmt, ##__VA_ARGS__); \
583} while (0)
584 571
585#ifdef CONFIG_DM_DEBUG 572#ifdef CONFIG_DM_DEBUG
586#define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) 573#define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
587#define DMDEBUG_LIMIT(fmt, ...) \ 574#define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__)
588do { \
589 if (dm_ratelimit()) \
590 DMDEBUG(fmt, ##__VA_ARGS__); \
591} while (0)
592#else 575#else
593#define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) 576#define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
594#define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__) 577#define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)