blkcg->cgwb_refcnt is used to delay blkcg offlining so that blkgs don't get offlined while there are active cgwbs on them. However, it ends up making offlining unordered sometimes causing parents to be offlined before children. Let's fix this by making child blkcgs pin the parents' online states. Note that pin/unpin names are chosen over get/put intentionally because css uses get/put online for something different.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -436,8 +436,12 @@ static inline void blkcg_pin_online(struct blkcg *blkcg) · 435 unmodified lines | ||
| 436 | 436 | */ |
| 437 | 437 | static inline void blkcg_unpin_online(struct blkcg *blkcg) |
| 438 | 438 | { |
| 439 | − if (refcount_dec_and_test(&blkcg->online_pin)) | |
| 439 | + do { | |
| 440 | + if (!refcount_dec_and_test(&blkcg->online_pin)) | |
| 441 | + break; | |
| 440 | 442 | blkcg_destroy_blkgs(blkcg); |
| 443 | + blkcg = blkcg_parent(blkcg); | |
| 444 | + } while (blkcg); | |
| 441 | 445 | } |
| 442 | 446 | |
| 443 | 447 | /** |