aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index f9797b244eb3..87ea95d1f533 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -504,8 +504,9 @@ static const char *blkg_dev_name(struct blkcg_gq *blkg)
504 * 504 *
505 * This function invokes @prfill on each blkg of @blkcg if pd for the 505 * This function invokes @prfill on each blkg of @blkcg if pd for the
506 * policy specified by @pol exists. @prfill is invoked with @sf, the 506 * policy specified by @pol exists. @prfill is invoked with @sf, the
507 * policy data and @data. If @show_total is %true, the sum of the return 507 * policy data and @data and the matching queue lock held. If @show_total
508 * values from @prfill is printed with "Total" label at the end. 508 * is %true, the sum of the return values from @prfill is printed with
509 * "Total" label at the end.
509 * 510 *
510 * This is to be used to construct print functions for 511 * This is to be used to construct print functions for
511 * cftype->read_seq_string method. 512 * cftype->read_seq_string method.
@@ -520,11 +521,14 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
520 struct hlist_node *n; 521 struct hlist_node *n;
521 u64 total = 0; 522 u64 total = 0;
522 523
523 spin_lock_irq(&blkcg->lock); 524 rcu_read_lock();
524 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) 525 hlist_for_each_entry_rcu(blkg, n, &blkcg->blkg_list, blkcg_node) {
526 spin_lock_irq(blkg->q->queue_lock);
525 if (blkcg_policy_enabled(blkg->q, pol)) 527 if (blkcg_policy_enabled(blkg->q, pol))
526 total += prfill(sf, blkg->pd[pol->plid], data); 528 total += prfill(sf, blkg->pd[pol->plid], data);
527 spin_unlock_irq(&blkcg->lock); 529 spin_unlock_irq(blkg->q->queue_lock);
530 }
531 rcu_read_unlock();
528 532
529 if (show_total) 533 if (show_total)
530 seq_printf(sf, "Total %llu\n", (unsigned long long)total); 534 seq_printf(sf, "Total %llu\n", (unsigned long long)total);