Skip to content

Commit d92c370

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: really clone the block cgroup in bio_clone_blkg_association
bio_clone_blkg_association is supposed to clone the associatation, but actually ends up doing a search with a tryget. As we know we have a reference on the source cgroup just get an unconditional additional reference to it and call it a day. That also removes the need for a RCU critical section. Acked-by: Tejun Heo <tj@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent db9819c commit d92c370

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎block/bio.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,12 +1737,12 @@ EXPORT_SYMBOL_GPL(bio_associate_blkg);
17371737
*/
17381738
void bio_clone_blkg_association(struct bio *dst, struct bio *src)
17391739
{
1740-
rcu_read_lock();
1741-
1742-
if (src->bi_blkg)
1743-
__bio_associate_blkg(dst, src->bi_blkg);
1744-
1745-
rcu_read_unlock();
1740+
if (src->bi_blkg) {
1741+
if (dst->bi_blkg)
1742+
blkg_put(dst->bi_blkg);
1743+
blkg_get(src->bi_blkg);
1744+
dst->bi_blkg = src->bi_blkg;
1745+
}
17461746
}
17471747
EXPORT_SYMBOL_GPL(bio_clone_blkg_association);
17481748
#endif /* CONFIG_BLK_CGROUP */

0 commit comments

Comments
 (0)