diff options
| -rw-r--r-- | block/bio.c | 3 | ||||
| -rw-r--r-- | block/blk-throttle.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/block/bio.c b/block/bio.c index b12966e415d3..8c680a776171 100644 --- a/block/bio.c +++ b/block/bio.c | |||
| @@ -2015,7 +2015,8 @@ int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg) | |||
| 2015 | { | 2015 | { |
| 2016 | if (unlikely(bio->bi_blkg)) | 2016 | if (unlikely(bio->bi_blkg)) |
| 2017 | return -EBUSY; | 2017 | return -EBUSY; |
| 2018 | blkg_get(blkg); | 2018 | if (!blkg_try_get(blkg)) |
| 2019 | return -ENODEV; | ||
| 2019 | bio->bi_blkg = blkg; | 2020 | bio->bi_blkg = blkg; |
| 2020 | return 0; | 2021 | return 0; |
| 2021 | } | 2022 | } |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index a3eede00d302..01d0620a4e4a 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
| @@ -2129,8 +2129,9 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td) | |||
| 2129 | static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio) | 2129 | static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio) |
| 2130 | { | 2130 | { |
| 2131 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW | 2131 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW |
| 2132 | if (bio->bi_css) | 2132 | /* fallback to root_blkg if we fail to get a blkg ref */ |
| 2133 | bio_associate_blkg(bio, tg_to_blkg(tg)); | 2133 | if (bio->bi_css && (bio_associate_blkg(bio, tg_to_blkg(tg)) == -ENODEV)) |
| 2134 | bio_associate_blkg(bio, bio->bi_disk->queue->root_blkg); | ||
| 2134 | bio_issue_init(&bio->bi_issue, bio_sectors(bio)); | 2135 | bio_issue_init(&bio->bi_issue, bio_sectors(bio)); |
| 2135 | #endif | 2136 | #endif |
| 2136 | } | 2137 | } |
