diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-04-06 16:51:31 +0200 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2012-04-13 11:01:40 -0500 |
commit | 68e68e1412ccf51f4c1d76795d4f8d3a9cdc1f27 (patch) | |
tree | 33bd1faf0522f79b5a53b62fd221b12428e72dce /drivers/md | |
parent | eb44992792e8792a74d0a5dc8fb7602259f12a9a (diff) |
md: raid5: Make raid5_percpu handling RT aware
__raid_run_ops() disables preemption with get_cpu() around the access
to the raid5_percpu variables. That causes scheduling while atomic
spews on RT.
Serialize the access to the percpu data with a lock and keep the code
preemptible.
Reported-by: Udo van den Heuvel <udovdh@xs4all.nl>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Udo van den Heuvel <udovdh@xs4all.nl>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5.c | 7 | ||||
-rw-r--r-- | drivers/md/raid5.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f351422938e0..02e2ea35f58a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1309,8 +1309,9 @@ static void __raid_run_ops(struct stripe_head *sh, unsigned long ops_request) struct raid5_percpu *percpu; unsigned long cpu; - cpu = get_cpu(); + cpu = get_cpu_light(); percpu = per_cpu_ptr(conf->percpu, cpu); + spin_lock(&percpu->lock); if (test_bit(STRIPE_OP_BIOFILL, &ops_request)) { ops_run_biofill(sh); overlap_clear++; @@ -1362,7 +1363,8 @@ static void __raid_run_ops(struct stripe_head *sh, unsigned long ops_request) if (test_and_clear_bit(R5_Overlap, &dev->flags)) wake_up(&sh->raid_conf->wait_for_overlap); } - put_cpu(); + spin_unlock(&percpu->lock); + put_cpu_light(); } #ifdef CONFIG_MULTICORE_RAID456 @@ -4758,6 +4760,7 @@ static int raid5_alloc_percpu(struct r5conf *conf) break; } per_cpu_ptr(conf->percpu, cpu)->scribble = scribble; + spin_lock_init(&per_cpu_ptr(conf->percpu, cpu)->lock); } #ifdef CONFIG_HOTPLUG_CPU conf->cpu_notify.notifier_call = raid456_cpu_notify; diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 8d8e13934a48..a7843112eb6a 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -417,6 +417,7 @@ struct r5conf { int recovery_disabled; /* per cpu variables */ struct raid5_percpu { + spinlock_t lock; /* Protection for -RT */ struct page *spare_page; /* Used when checking P/Q in raid6 */ void *scribble; /* space for constructing buffer * lists and performing address |