summaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@kvack.org>2014-07-14 13:14:27 -0400
committerBenjamin LaHaise <bcrl@kvack.org>2014-07-14 13:14:27 -0400
commit6e830d53717cf3d5c30c1afce3773ef97e436cd9 (patch)
tree9376a0424b8f9fff12d107aa2498e775da20e85d /fs/aio.c
parent855ef0dec7271ff7be7381feaaf3f4aed80bd503 (diff)
parent263782c1c95bbddbb022dc092fd89a36bb8d5577 (diff)
Merge ../aio-fixes
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index c1d8c480c13..8216aa0c753 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -812,16 +812,20 @@ void exit_aio(struct mm_struct *mm)
static void put_reqs_available(struct kioctx *ctx, unsigned nr)
{
struct kioctx_cpu *kcpu;
+ unsigned long flags;
preempt_disable();
kcpu = this_cpu_ptr(ctx->cpu);
+ local_irq_save(flags);
kcpu->reqs_available += nr;
+
while (kcpu->reqs_available >= ctx->req_batch * 2) {
kcpu->reqs_available -= ctx->req_batch;
atomic_add(ctx->req_batch, &ctx->reqs_available);
}
+ local_irq_restore(flags);
preempt_enable();
}
@@ -829,10 +833,12 @@ static bool get_reqs_available(struct kioctx *ctx)
{
struct kioctx_cpu *kcpu;
bool ret = false;
+ unsigned long flags;
preempt_disable();
kcpu = this_cpu_ptr(ctx->cpu);
+ local_irq_save(flags);
if (!kcpu->reqs_available) {
int old, avail = atomic_read(&ctx->reqs_available);
@@ -851,6 +857,7 @@ static bool get_reqs_available(struct kioctx *ctx)
ret = true;
kcpu->reqs_available--;
out:
+ local_irq_restore(flags);
preempt_enable();
return ret;
}