diff options
-rw-r--r-- | fs/aio.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -830,16 +830,20 @@ void exit_aio(struct mm_struct *mm) | |||
830 | static void put_reqs_available(struct kioctx *ctx, unsigned nr) | 830 | static void put_reqs_available(struct kioctx *ctx, unsigned nr) |
831 | { | 831 | { |
832 | struct kioctx_cpu *kcpu; | 832 | struct kioctx_cpu *kcpu; |
833 | unsigned long flags; | ||
833 | 834 | ||
834 | preempt_disable(); | 835 | preempt_disable(); |
835 | kcpu = this_cpu_ptr(ctx->cpu); | 836 | kcpu = this_cpu_ptr(ctx->cpu); |
836 | 837 | ||
838 | local_irq_save(flags); | ||
837 | kcpu->reqs_available += nr; | 839 | kcpu->reqs_available += nr; |
840 | |||
838 | while (kcpu->reqs_available >= ctx->req_batch * 2) { | 841 | while (kcpu->reqs_available >= ctx->req_batch * 2) { |
839 | kcpu->reqs_available -= ctx->req_batch; | 842 | kcpu->reqs_available -= ctx->req_batch; |
840 | atomic_add(ctx->req_batch, &ctx->reqs_available); | 843 | atomic_add(ctx->req_batch, &ctx->reqs_available); |
841 | } | 844 | } |
842 | 845 | ||
846 | local_irq_restore(flags); | ||
843 | preempt_enable(); | 847 | preempt_enable(); |
844 | } | 848 | } |
845 | 849 | ||
@@ -847,10 +851,12 @@ static bool get_reqs_available(struct kioctx *ctx) | |||
847 | { | 851 | { |
848 | struct kioctx_cpu *kcpu; | 852 | struct kioctx_cpu *kcpu; |
849 | bool ret = false; | 853 | bool ret = false; |
854 | unsigned long flags; | ||
850 | 855 | ||
851 | preempt_disable(); | 856 | preempt_disable(); |
852 | kcpu = this_cpu_ptr(ctx->cpu); | 857 | kcpu = this_cpu_ptr(ctx->cpu); |
853 | 858 | ||
859 | local_irq_save(flags); | ||
854 | if (!kcpu->reqs_available) { | 860 | if (!kcpu->reqs_available) { |
855 | int old, avail = atomic_read(&ctx->reqs_available); | 861 | int old, avail = atomic_read(&ctx->reqs_available); |
856 | 862 | ||
@@ -869,6 +875,7 @@ static bool get_reqs_available(struct kioctx *ctx) | |||
869 | ret = true; | 875 | ret = true; |
870 | kcpu->reqs_available--; | 876 | kcpu->reqs_available--; |
871 | out: | 877 | out: |
878 | local_irq_restore(flags); | ||
872 | preempt_enable(); | 879 | preempt_enable(); |
873 | return ret; | 880 | return ret; |
874 | } | 881 | } |