Skip to content

Commit f5482ee

Browse files
committed
block: WARN if bdev inflight counter is negative
Which means there is a bug for related bio-based disk driver, or blk-mq for rq-based disk, it's better not to hide the bug. Link: https://lore.kernel.org/linux-raid/20250506124903.2540268-3-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: John Garry <john.g.garry@oracle.com>
1 parent 5b8f19a commit f5482ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block/genhd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ static void part_in_flight_rw(struct block_device *part,
136136
inflight[0] += part_stat_local_read_cpu(part, in_flight[0], cpu);
137137
inflight[1] += part_stat_local_read_cpu(part, in_flight[1], cpu);
138138
}
139-
if ((int)inflight[0] < 0)
139+
if (WARN_ON_ONCE((int)inflight[0] < 0))
140140
inflight[0] = 0;
141-
if ((int)inflight[1] < 0)
141+
if (WARN_ON_ONCE((int)inflight[1] < 0))
142142
inflight[1] = 0;
143143
}
144144

0 commit comments

Comments
 (0)