Skip to content
  • Tejun Heo's avatar
    blkcg: blkcg_css_alloc() should grab blkcg_pol_mutex while iterating blkcg_policy[] · 144232b3
    Tejun Heo authored
    
    
    An entry in blkcg_policy[] is stable while there are non-bypassing
    in-flight IOs on a request_queue which has the policy activated.  This
    is why most derefs of blkcg_policy[] don't need explicit locking;
    however, blkcg_css_alloc() isn't invoked from IO path and thus doesn't
    have this protection and may race policies being added and removed.
    
    Fix it by adding explicit blkcg_pol_mutex protection around
    blkcg_policy[] iteration in blkcg_css_alloc().
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Fixes: e48453c3
    
     ("block, cgroup: implement policy-specific per-blkcg data")
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    144232b3