]> Git Repo - linux.git/commitdiff
block: really clone the block cgroup in bio_clone_blkg_association
authorChristoph Hellwig <[email protected]>
Sat, 27 Jun 2020 07:31:48 +0000 (09:31 +0200)
committerJens Axboe <[email protected]>
Mon, 29 Jun 2020 15:09:08 +0000 (09:09 -0600)
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 <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/bio.c

index 8aef4460b32e0e7e8a2006d9c286f5256d976f5f..e1d01acce8070c14c375bf14ade6d00793df6341 100644 (file)
@@ -1737,12 +1737,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();
+       if (src->bi_blkg) {
+               if (dst->bi_blkg)
+                       blkg_put(dst->bi_blkg);
+               blkg_get(src->bi_blkg);
+               dst->bi_blkg = src->bi_blkg;
+       }
 }
 EXPORT_SYMBOL_GPL(bio_clone_blkg_association);
 #endif /* CONFIG_BLK_CGROUP */
This page took 0.07069 seconds and 4 git commands to generate.