On 5/25/23 10:11, Michal Koutný wrote:
On Wed, May 24, 2023 at 10:37:10AM +0800, Ming Lei <ming.lei@xxxxxxxxxx> wrote:
I am not at all familiar with blkcg, but does calling
cgroup_rstat_flush() in offline_css() fix the problem?
Except for offline, this list needs to be flushed after the associated disk
is deleted.
Why the second flush trigger?
a) To break another ref-dependency cycle (like on the blkcg side)?
b) To avoid stale data upon device removal?
(Because b) should be unnecessary, a future reader would flush when
needed.)
Since the percpu blkg_iostat_set's that are linked in the lockless list
will be freed if the corresponding blkcg_gq is freed, we need to flush
the lockless list to avoid potential use-after-free in a future
cgroup_rstat_flush*() call.
Cheers,
Longman