diff options
author | Mike Snitzer <snitzer@redhat.com> | 2016-08-05 12:29:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-07 08:34:52 +0200 |
commit | 1bb779a230b8e10ca3833c5a3a59f7528d36e0d3 (patch) | |
tree | 860a1a3868548c5afdbdf4d0bb82daa243e62ab0 /drivers | |
parent | 395b2913861889d766ca8c28d0262658b265ceac (diff) | |
download | linux-stable-1bb779a230b8e10ca3833c5a3a59f7528d36e0d3.tar.gz linux-stable-1bb779a230b8e10ca3833c5a3a59f7528d36e0d3.tar.bz2 linux-stable-1bb779a230b8e10ca3833c5a3a59f7528d36e0d3.zip |
dm round robin: do not use this_cpu_ptr() without having preemption disabled
commit 802934b2cfde463b72cc1b9bc1c081895a90be53 upstream.
Use local_irq_save() to disable preemption before calling
this_cpu_ptr().
Reported-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Fixes: b0b477c7e0dd ("dm round robin: use percpu 'repeat_count' and 'current_path'")
Suggested-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-round-robin.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/dm-round-robin.c b/drivers/md/dm-round-robin.c index 4ace1da17db8..6c25213ab38c 100644 --- a/drivers/md/dm-round-robin.c +++ b/drivers/md/dm-round-robin.c @@ -210,14 +210,17 @@ static struct dm_path *rr_select_path(struct path_selector *ps, size_t nr_bytes) struct path_info *pi = NULL; struct dm_path *current_path = NULL; + local_irq_save(flags); current_path = *this_cpu_ptr(s->current_path); if (current_path) { percpu_counter_dec(&s->repeat_count); - if (percpu_counter_read_positive(&s->repeat_count) > 0) + if (percpu_counter_read_positive(&s->repeat_count) > 0) { + local_irq_restore(flags); return current_path; + } } - spin_lock_irqsave(&s->lock, flags); + spin_lock(&s->lock); if (!list_empty(&s->valid_paths)) { pi = list_entry(s->valid_paths.next, struct path_info, list); list_move_tail(&pi->list, &s->valid_paths); |