linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: warn if throttle group is null
@ 2022-07-21  8:16 Ming Lei
  0 siblings, 0 replies; only message in thread
From: Ming Lei @ 2022-07-21  8:16 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Mike Snitzer

If BLK_DEV_THROTTLING is enabled, bio->bi_blkg shouldn't be NULL, so
warn if it is found as NULL, then return false and bypass throttling.

It helps Mike to figure out one dm-raid problem.

Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-throttle.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-throttle.h b/block/blk-throttle.h
index c1b602996127..55e93b3f3205 100644
--- a/block/blk-throttle.h
+++ b/block/blk-throttle.h
@@ -174,6 +174,9 @@ static inline bool blk_throtl_bio(struct bio *bio)
 {
 	struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg);
 
+	if (WARN_ON_ONCE(!tg))
+		return false;
+
 	/* no need to throttle bps any more if the bio has been throttled */
 	if (bio_flagged(bio, BIO_THROTTLED) &&
 	    !(tg->flags & THROTL_TG_HAS_IOPS_LIMIT))
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-21  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21  8:16 [PATCH] block: warn if throttle group is null Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).