blkcg: clean up blkg_tryget_closest()

The implementation of blkg_tryget_closest() wasn't super obvious and
became a point of suspicion when debugging [1]. So let's clean it up so
it's obviously not the problem.

Also add missing RCU read locking to bio_clone_blkg_association(), which
got exposed by adding the RCU read lock held check in
blkg_tryget_closest().

[1] https://lore.kernel.org/linux-block/[email protected]/

Signed-off-by: Dennis Zhou <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Dennis Zhou 2018-12-19 16:43:21 -06:00 • committed by Jens Axboe
commit 6ab2187992
2 changed files with 20 additions and 5 deletions

View file

@ -2096,8 +2096,12 @@ EXPORT_SYMBOL_GPL(bio_associate_blkg);
*/
void bio_clone_blkg_association(struct bio *dst, struct bio *src)
{
rcu_read_lock();
if (src->bi_blkg)
__bio_associate_blkg(dst, src->bi_blkg);
rcu_read_unlock();
}
EXPORT_SYMBOL_GPL(bio_clone_blkg_association);
#endif /* CONFIG_BLK_CGROUP */