summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-04-06 14:51:31 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-10 00:19:22 (GMT)
commita73bde4dcfa135b3611f33157755f7acc5fa7ddf (patch)
tree62c77f01280e3464344d022755565274ec267872 /drivers/md
parentc3429f72c9ea824c08763c389bacf245f1c74452 (diff)
downloadlinux-fsl-qoriq-a73bde4dcfa135b3611f33157755f7acc5fa7ddf.tar.xz
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.c7
-rw-r--r--drivers/md/raid5.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3ecfb06..ab00c1e 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1541,8 +1541,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++;
@@ -1594,7 +1595,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();
}
static int grow_one_stripe(struct r5conf *conf)
@@ -5456,6 +5458,7 @@ static int raid5_alloc_percpu(struct r5conf *conf)
__func__, cpu);
break;
}
+ spin_lock_init(&per_cpu_ptr(conf->percpu, cpu)->lock);
}
put_online_cpus();
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 2113ffa..0a5e1e1 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -444,6 +444,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