提交 b1edc4c1 编写于 作者: X Xiaoguang Wang 提交者: Joseph Qi

alinux: blk-throttle: fix logic error about BIO_THROTL_STATED in throtl_bio_end_io()

When CONFIG_BLK_DEV_THROTTLING is enabled, though we may not set
block cgroup's blk-throttle bps or iops limits, every bio still
enters blk_throtl_bio() firstly, then this bug will result in the
corresponding blkcg_gq's refcnt will increase by 1 for every bio.
atomit_t is an 'int' type, and if usr continually issues batches
of bios, this refcnt will overflow, which will trigger WARNING in
blkg_get() or blkg_put().

Fixes: 4667e926 ("alios: blk-throttle: fix tg NULL pointer dereference")
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 bf583952
......@@ -1120,7 +1120,7 @@ static void throtl_bio_end_io(struct bio *bio)
rcu_read_lock();
/* see comments in throtl_bio_stats_start() */
if (bio_flagged(bio, BIO_THROTL_STATED))
if (!bio_flagged(bio, BIO_THROTL_STATED))
goto out;
tg = (struct throtl_grp *)bio->bi_tg_private;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册