From: Boy Wu <boy.wu@xxxxxxxxxxxx> In 32bit SMP systems, if the system is stressed on the sys node by processes, it may cause blkcg_fill_root_iostats to have a concurrent problem on the seqlock in u64_stats_update, which will cause a deadlock on u64_stats_fetch_begin in blkcg_print_one_stat. To prevent this problem, add spin_locks. Fixes: ef45fe470e1e ("blk-cgroup: show global disk stats in root cgroup io.stat") Signed-off-by: Boy Wu <boy.wu@xxxxxxxxxxxx> --- block/blk-cgroup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 37e6cc91d576..a633b7431e91 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1134,9 +1134,15 @@ static void blkcg_fill_root_iostats(void) cpu_dkstats->sectors[STAT_DISCARD] << 9; } +#if BITS_PER_LONG == 32 + spin_lock_irq(&blkg->q->queue_lock); +#endif flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync); blkg_iostat_set(&blkg->iostat.cur, &tmp); u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags); +#if BITS_PER_LONG == 32 + spin_unlock_irq(&blkg->q->queue_lock); +#endif } } -- 2.18.0