Skip to content

Commit 950cda7

Browse files
Hong Zhiguogregkh
authored andcommitted
Update of blkg_stat and blkg_rwstat may happen in bh context. While u64_stats_fetch_retry is only preempt_disable on 32bit UP system. This is not enough to avoid preemption by bh and may read strange 64 bit value.
commit 2c57502 upstream. Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c523480 commit 950cda7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎block/blk-cgroup.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
399399
uint64_t v;
400400

401401
do {
402-
start = u64_stats_fetch_begin(&stat->syncp);
402+
start = u64_stats_fetch_begin_bh(&stat->syncp);
403403
v = stat->cnt;
404-
} while (u64_stats_fetch_retry(&stat->syncp, start));
404+
} while (u64_stats_fetch_retry_bh(&stat->syncp, start));
405405

406406
return v;
407407
}
@@ -467,9 +467,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
467467
struct blkg_rwstat tmp;
468468

469469
do {
470-
start = u64_stats_fetch_begin(&rwstat->syncp);
470+
start = u64_stats_fetch_begin_bh(&rwstat->syncp);
471471
tmp = *rwstat;
472-
} while (u64_stats_fetch_retry(&rwstat->syncp, start));
472+
} while (u64_stats_fetch_retry_bh(&rwstat->syncp, start));
473473

474474
return tmp;
475475
}

0 commit comments

Comments
 (0)