[PATCH] block: warn if throttle group is null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux