Skip to content

Commit 5370b0f

Browse files
htejunaxboe
authored andcommitted
blk-cgroup: blk_cgroup_bio_start() should use irq-safe operations on blkg->iostat_cpu
c3df5fb ("cgroup: rstat: fix A-A deadlock on 32bit around u64_stats_sync") made u64_stats updates irq-safe to avoid A-A deadlocks. Unfortunately, the conversion missed one in blk_cgroup_bio_start(). Fix it. Fixes: 2d146aa ("mm: memcontrol: switch to rstat") Cc: [email protected] # v5.13+ Reported-by: [email protected] Signed-off-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d29bd41 commit 5370b0f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

block/blk-cgroup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,10 +1897,11 @@ void blk_cgroup_bio_start(struct bio *bio)
18971897
{
18981898
int rwd = blk_cgroup_io_type(bio), cpu;
18991899
struct blkg_iostat_set *bis;
1900+
unsigned long flags;
19001901

19011902
cpu = get_cpu();
19021903
bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu);
1903-
u64_stats_update_begin(&bis->sync);
1904+
flags = u64_stats_update_begin_irqsave(&bis->sync);
19041905

19051906
/*
19061907
* If the bio is flagged with BIO_CGROUP_ACCT it means this is a split
@@ -1912,7 +1913,7 @@ void blk_cgroup_bio_start(struct bio *bio)
19121913
}
19131914
bis->cur.ios[rwd]++;
19141915

1915-
u64_stats_update_end(&bis->sync);
1916+
u64_stats_update_end_irqrestore(&bis->sync, flags);
19161917
if (cgroup_subsys_on_dfl(io_cgrp_subsys))
19171918
cgroup_rstat_updated(bio->bi_blkg->blkcg->css.cgroup, cpu);
19181919
put_cpu();

0 commit comments

Comments
 (0)