Commit d1969a84dd6a44d375aa82bba7d6c38713a429c3

Authored by Hugh Dickins
Committed by Linus Torvalds
1 parent 85ce70fdf4

percpu_counter: unbreak __percpu_counter_add()

Commit 74e72f894d56 ("lib/percpu_counter.c: fix __percpu_counter_add()")
looked very plausible, but its arithmetic was badly wrong: obvious once
you see the fix, but maddening to get there from the weird tmpfs ENOSPCs

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Shaohua Li <shli@fusionio.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Fan Du <fan.du@windriver.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

lib/percpu_counter.c
... ... @@ -82,7 +82,7 @@
82 82 unsigned long flags;
83 83 raw_spin_lock_irqsave(&fbc->lock, flags);
84 84 fbc->count += count;
85   - __this_cpu_sub(*fbc->counters, count);
  85 + __this_cpu_sub(*fbc->counters, count - amount);
86 86 raw_spin_unlock_irqrestore(&fbc->lock, flags);
87 87 } else {
88 88 this_cpu_add(*fbc->counters, amount);