hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAUKH4 CVE: NA
--------------------------------
This reverts commit 2c7b55097150add1295e9329e00a6dffeaf84636.
Fixes: 2c7b55097150 ("blk-throttle: Set BIO_THROTTLED when bio has been throttled") Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/blk-throttle.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 4e5cfc1c79e0..8a22fd8449bf 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2279,16 +2279,13 @@ bool blk_throtl_bio(struct bio *bio) struct throtl_service_queue *sq; bool rw = bio_data_dir(bio); bool throttled = false; - bool locked = true; struct throtl_data *td = tg->td;
rcu_read_lock();
/* see throtl_charge_bio() */ - if (bio_flagged(bio, BIO_THROTTLED)) { - locked = false; + if (bio_flagged(bio, BIO_THROTTLED)) goto out; - }
if (!cgroup_subsys_on_dfl(io_cgrp_subsys)) { blkg_rwstat_add(&tg->stat_bytes, bio->bi_opf, @@ -2296,10 +2293,8 @@ bool blk_throtl_bio(struct bio *bio) blkg_rwstat_add(&tg->stat_ios, bio->bi_opf, 1); }
- if (!tg->has_rules[rw]) { - locked = false; + if (!tg->has_rules[rw]) goto out; - }
spin_lock_irq(&q->queue_lock);
@@ -2354,7 +2349,7 @@ bool blk_throtl_bio(struct bio *bio) sq = sq->parent_sq; tg = sq_to_tg(sq); if (!tg) - goto out; + goto out_unlock; }
/* out-of-limit, queue to @tg */ @@ -2382,6 +2377,8 @@ bool blk_throtl_bio(struct bio *bio) throtl_schedule_next_dispatch(tg->service_queue.parent_sq, true); }
+out_unlock: + spin_unlock_irq(&q->queue_lock); out: bio_set_flag(bio, BIO_THROTTLED);
@@ -2389,9 +2386,6 @@ bool blk_throtl_bio(struct bio *bio) if (throttled || !td->track_bio_latency) bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY; #endif - if (locked) - spin_unlock_irq(&q->queue_lock); - rcu_read_unlock(); return throttled; }