Skip to content

Commit

Permalink
Update of blkg_stat and blkg_rwstat may happen in bh context.
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Hong Zhiguo <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Hong Zhiguo authored and axboe committed Nov 20, 2013
1 parent 82023bb commit 2c57502
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block/blk-cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
uint64_t v;

do {
start = u64_stats_fetch_begin(&stat->syncp);
start = u64_stats_fetch_begin_bh(&stat->syncp);
v = stat->cnt;
} while (u64_stats_fetch_retry(&stat->syncp, start));
} while (u64_stats_fetch_retry_bh(&stat->syncp, start));

return v;
}
Expand Down Expand Up @@ -508,9 +508,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
struct blkg_rwstat tmp;

do {
start = u64_stats_fetch_begin(&rwstat->syncp);
start = u64_stats_fetch_begin_bh(&rwstat->syncp);
tmp = *rwstat;
} while (u64_stats_fetch_retry(&rwstat->syncp, start));
} while (u64_stats_fetch_retry_bh(&rwstat->syncp, start));

return tmp;
}
Expand Down

0 comments on commit 2c57502

Please sign in to comment.