aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2019-05-07 10:01:49 -0700
committerDennis Zhou <dennis@kernel.org>2019-05-09 10:50:59 -0700
commitddde2af747ad79010f14691f381522987fbcb860 (patch)
tree6e2b6287133d7ae7f2a49ba3f1a4dc014933806c /drivers/md/md.c
parentio_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT (diff)
downloadlinux-dev-ddde2af747ad79010f14691f381522987fbcb860.tar.xz
linux-dev-ddde2af747ad79010f14691f381522987fbcb860.zip
md: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT
Percpu reference counters should now be initialized with the PERCPU_REF_ALLOW_REINIT in order to allow switching them to the percpu mode from the atomic mode. To make percpu_ref_switch_to_percpu() call in set_in_sync() succeed,let's initialize percpu refcounters with the PERCU_REF_ALLOW_REINIT flag. Signed-off-by: Roman Gushchin <guro@fb.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Dennis Zhou <dennis@kernel.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 05ffffb8b769..16e034747a86 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5249,7 +5249,8 @@ int mddev_init_writes_pending(struct mddev *mddev)
{
if (mddev->writes_pending.percpu_count_ptr)
return 0;
- if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0)
+ if (percpu_ref_init(&mddev->writes_pending, no_op,
+ PERCPU_REF_ALLOW_REINIT, GFP_KERNEL) < 0)
return -ENOMEM;
/* We want to start with the refcount at zero */
percpu_ref_put(&mddev->writes_pending);