Commit 144232b
blkcg: blkcg_css_alloc() should grab blkcg_pol_mutex while iterating blkcg_policy[]
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: Tejun Heo <tj@kernel.org>
Fixes: e48453c ("block, cgroup: implement policy-specific per-blkcg data")
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>1 parent 838f13b commit 144232b
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| 847 | + | |
| 848 | + | |
847 | 849 | | |
848 | 850 | | |
849 | 851 | | |
| |||
860 | 862 | | |
861 | 863 | | |
862 | 864 | | |
| 865 | + | |
863 | 866 | | |
864 | 867 | | |
865 | 868 | | |
| |||
868 | 871 | | |
869 | 872 | | |
870 | 873 | | |
| 874 | + | |
871 | 875 | | |
872 | 876 | | |
873 | 877 | | |
| |||
0 commit comments