diff options
| -rw-r--r-- | fs/aio.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -490,7 +490,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
| 490 | return ERR_PTR(-EINVAL); | 490 | return ERR_PTR(-EINVAL); |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | if (!nr_events || (unsigned long)nr_events > aio_max_nr) | 493 | if (!nr_events || (unsigned long)nr_events > (aio_max_nr * 2UL)) |
| 494 | return ERR_PTR(-EAGAIN); | 494 | return ERR_PTR(-EAGAIN); |
| 495 | 495 | ||
| 496 | ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL); | 496 | ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL); |
| @@ -522,7 +522,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
| 522 | 522 | ||
| 523 | /* limit the number of system wide aios */ | 523 | /* limit the number of system wide aios */ |
| 524 | spin_lock(&aio_nr_lock); | 524 | spin_lock(&aio_nr_lock); |
| 525 | if (aio_nr + nr_events > aio_max_nr || | 525 | if (aio_nr + nr_events > (aio_max_nr * 2UL) || |
| 526 | aio_nr + nr_events < aio_nr) { | 526 | aio_nr + nr_events < aio_nr) { |
| 527 | spin_unlock(&aio_nr_lock); | 527 | spin_unlock(&aio_nr_lock); |
| 528 | goto out_cleanup; | 528 | goto out_cleanup; |
