Skip to contentSkip to conversation

block: warn if throttle group is null

PATCH New Ming Lei 1 participant 1 message Jul 21, 2022 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: warn if throttle group is null

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 <[email protected]>
---
 block/blk-throttle.h | 3 +++
 1 file changed, 3 insertions(+)
block/blk-throttle.h +3 -0
index c1b602996127..55e93b3f3205 100644
@@ -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))
Signature · 1 line
2.31.1